X-Git-Url: https://git.ozlabs.org/?a=blobdiff_plain;f=apps%2Fpatchwork%2Fviews%2Fxmlrpc.py;h=283eb34be865fd129c5b1ddcd09328f3fa98e225;hb=539b6596dc1bf1d3118631095625e354026da373;hp=0d3321fc259d5e431cfc643d7fbd48d850ecf890;hpb=5b984a0262c42ef5ac8f05a687978235a12a6e28;p=patchwork diff --git a/apps/patchwork/views/xmlrpc.py b/apps/patchwork/views/xmlrpc.py index 0d3321f..283eb34 100644 --- a/apps/patchwork/views/xmlrpc.py +++ b/apps/patchwork/views/xmlrpc.py @@ -20,15 +20,12 @@ # Patchwork XMLRPC interface # -from django.core.exceptions import ImproperlyConfigured from SimpleXMLRPCServer import SimpleXMLRPCDispatcher from django.http import HttpResponse, HttpResponseRedirect, \ HttpResponseServerError -from django.conf import settings from django.core import urlresolvers -from django.shortcuts import render_to_response from django.contrib.auth import authenticate -from patchwork.models import Patch, Project, Person, Bundle, State +from patchwork.models import Patch, Project, Person, State from django.views.decorators.csrf import csrf_exempt import sys @@ -59,14 +56,14 @@ class PatchworkXMLRPCDispatcher(SimpleXMLRPCDispatcher): def _user_for_request(self, request): - auth_header = None + auth_header = None - if request.META.has_key('HTTP_AUTHORIZATION'): - auth_header = request.META.get('HTTP_AUTHORIZATION') - elif request.META.has_key('Authorization'): - auth_header = request.META.get('Authorization') + if 'HTTP_AUTHORIZATION' in request.META: + auth_header = request.META.get('HTTP_AUTHORIZATION') + elif 'Authorization' in request.META: + auth_header = request.META.get('Authorization') - if auth_header is None or auth_header == '': + if auth_header is None or auth_header == '': raise Exception("No authentication credentials given") str = auth_header.strip() @@ -132,7 +129,7 @@ def xmlrpc(request): try: ret = dispatcher._marshaled_dispatch(request) response.write(ret) - except Exception, e: + except Exception: return HttpResponseServerError() return response @@ -331,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)