]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/views/xmlrpc.py
tox: Add tox.ini file
[patchwork] / apps / patchwork / views / xmlrpc.py
index a69c8586b985a764623d71a4db33bdb82c1b2ac7..84ed4089b346812f241789e35af4e69624302080 100644 (file)
@@ -26,6 +26,7 @@ from django.http import HttpResponse, HttpResponseRedirect, \
 from django.core import urlresolvers
 from django.contrib.auth import authenticate
 from patchwork.models import Patch, Project, Person, State
+from patchwork.views import patch_to_mbox
 from django.views.decorators.csrf import csrf_exempt
 
 import sys
@@ -99,7 +100,7 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher):
 
     def _marshaled_dispatch(self, request):
         try:
-            params, method = xmlrpclib.loads(request.raw_post_data)
+            params, method = xmlrpclib.loads(request.body)
 
             response = self._dispatch(request, method, params)
             # wrap response in a singleton tuple
@@ -197,6 +198,7 @@ def patch_to_dict(obj):
          'project_id'   : obj.project_id,
          'state'        : unicode(obj.state).encode("utf-8"),
          'state_id'     : obj.state_id,
+         'archived'     : obj.archived,
          'submitter'    : unicode(obj.submitter).encode("utf-8"),
          'submitter_id' : obj.submitter_id,
          'delegate'     : unicode(obj.delegate).encode("utf-8"),
@@ -298,6 +300,7 @@ def patch_list(filter={}):
             "project_id",
             "submitter_id",
             "delegate_id",
+            "archived",
             "state_id",
             "date",
             "commit_ref",
@@ -325,6 +328,9 @@ def patch_list(filter={}):
             elif parts[0] == 'submitter_id':
                 dfilter['submitter'] = Person.objects.filter(id =
                                         filter[key])[0]
+            elif parts[0] == 'delegate_id':
+                dfilter['delegate'] = Person.objects.filter(id =
+                                        filter[key])[0]
             elif parts[0] == 'state_id':
                 dfilter['state'] = State.objects.filter(id =
                                         filter[key])[0]
@@ -376,7 +382,7 @@ def patch_get_mbox(patch_id):
     """Return mbox string for the given patch ID."""
     try:
         patch = Patch.objects.filter(id = patch_id)[0]
-        return patch.mbox().as_string()
+        return patch_to_mbox(patch).as_string(True)
     except:
         return ""