-
-
/trunk/djblets/djblets/webapi/auth.py (Diff revision 1) 1 blank line between standard libraries and 3rd-party libraries.
-
/trunk/djblets/djblets/webapi/core.py (Diff revision 1) This should probably be named something like BasicJSONEncoder
-
/trunk/djblets/djblets/webapi/core.py (Diff revision 1) I don't like this going into settings. We really ought to try to keep settings entirely focused on actual user deployments, and not let implementation details slip in. How about you construct a WebAPIResponse with an encoder?
-
/trunk/djblets/djblets/webapi/core.py (Diff revision 1) Either remove this or explain why it's commented out.
-
/trunk/djblets/djblets/webapi/core.py (Diff revision 1) 404 isn't a useful error here, and won't help anyone trying to implement something other than JSON.
Add a generic WebAPI app to Djblets
Review Request #221 — Created Feb. 7, 2008 and submitted
Information | |
---|---|
chipx86 | |
Navi (deprecated) | |
trunk | |
Reviewers | |
reviewboard | |
Moved much of our Review Board JSON code to Djblets and changed it to be more generic. While it only outputs JSON right now, it will be updated in an upcoming change to output XML files, if specified. We'll be able to include our webapi urls.py twice, once with a JSON path and once with an XML path, and we should be able to access the data both ways. To make this more generic, we no longer hard-code an object encoder. Now we use the ones specified in the project's settings.py file, using the WEB_API_ENCODERS variable. There's a base WebAPIEncoder class that can be overridden to provide custom encoders. We provide a BasicAPIEncoder, but projects can include their own and add it to the WEB_API_ENCODERS list. The serializer code will iterate through all registered encoders, trying to find a suitable encoder for the particular object.
Updated Review Board to use these new classes. It appears to be working so far.