]> git.ozlabs.org Git - patchwork/blobdiff - apps/patchwork/views/xmlrpc.py
xmlrpc: do slice before patch_to_dict
[patchwork] / apps / patchwork / views / xmlrpc.py
index 1d9d389c528a815342d6953b5b8b47147fe8a21f..283eb34be865fd129c5b1ddcd09328f3fa98e225 100644 (file)
@@ -58,9 +58,9 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher):
     def _user_for_request(self, request):
         auth_header = None
 
-        if request.META.has_key('HTTP_AUTHORIZATION'):
+        if 'HTTP_AUTHORIZATION' in request.META:
             auth_header = request.META.get('HTTP_AUTHORIZATION')
-        elif request.META.has_key('Authorization'):
+        elif 'Authorization' in request.META:
             auth_header = request.META.get('Authorization')
 
         if auth_header is None or auth_header == '':
@@ -129,7 +129,7 @@ def xmlrpc(request):
     try:
         ret = dispatcher._marshaled_dispatch(request)
         response.write(ret)
-    except Exception, e:
+    except Exception:
         return HttpResponseServerError()
 
     return response
@@ -328,7 +328,7 @@ def patch_list(filter={}):
         patches = Patch.objects.filter(**dfilter)
 
         if max_count > 0:
-            return map(patch_to_dict, patches)[:max_count]
+            return map(patch_to_dict, patches[:max_count])
         else:
             return map(patch_to_dict, patches)