Internal errors for invalid requests

Ralf Baechle ralf at linux-mips.org
Sat Jan 21 01:50:25 EST 2012


Patchwork doesn't handle incorrect requests such as

  https://patchwork.linux-mips.org/project/linux-mips/list/?=Blah&submitter=999

very nicely.  In this case neither user Blah not submitter 999 do exist.
The user will receive an 'Internal Server Error' error and the admin
another email ...  Lately I'm receiving a fair number of this sort of
broken requests, so this problem is getting a little annoying.

Subject: [Django] Error (EXTERNAL IP): /project/linux-mips/list/
From:   root at localhost
To:     ralf at linux-mips.org
Date:   Fri, 20 Jan 2012 14:18:08 -0000

Traceback (most recent call last):

  File "/var/www/patchwork.linux-mips.org/patchwork/lib/python/django/core/handlers/base.py", line 100, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/views/patch.py", line 106, in list
    view_args = {'project_id': project.linkname})

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/views/__init__.py", line 32, in generic_list
    list_view_params = view_args)

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/requestcontext.py", line 45, in __init__
    self.filters = Filters(request)

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/filters.py", line 415, in __init__
    f.parse(self.dict)

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/filters.py", line 56, in parse
    self._set_key(dict[self.param])

  File "/var/www/patchwork.linux-mips.org/patchwork/apps/patchwork/filters.py", line 98, in _set_key
    self.person = Person.objects.get(id = int(str))

  File "/var/www/patchwork.linux-mips.org/patchwork/lib/python/django/db/models/manager.py", line 132, in get
    return self.get_query_set().get(*args, **kwargs)

  File "/var/www/patchwork.linux-mips.org/patchwork/lib/python/django/db/models/query.py", line 347, in get
    % self.model._meta.object_name)

DoesNotExist: Person matching query does not exist.


<ModPythonRequest
path:/project/linux-mips/list/,
GET:<QueryDict: {u'': [u'Blah'], u'submitter': [u'999']}>,
POST:<QueryDict: {}>,
COOKIES:{'csrftoken': 'ae525056ac7a24f567da3a803ec167d1',
 'sessionid': 'd73ee3afc84ea5d25c671cf4dc3f973d'},
META:{'AUTH_TYPE': None,
 'CONTENT_LENGTH': 0,
 'CONTENT_TYPE': None,
 'CSRF_COOKIE': 'ae525056ac7a24f567da3a803ec167d1',
 'GATEWAY_INTERFACE': 'CGI/1.1',
 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
 'HTTP_ACCEPT_ENCODING': 'gzip,deflate',
 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5',
 'HTTP_CONNECTION': 'keep-alive',
 'HTTP_COOKIE': 'csrftoken=ae525056ac7a24f567da3a803ec167d1; sessionid=d73ee3afc84ea5d25c671cf4dc3f973d',
 'HTTP_HOST': 'patchwork.linux-mips.org',
 'HTTP_KEEP_ALIVE': '115',
 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.6.24-1.fc14 Firefox/3.6.24',
 'PATH_INFO': u'/project/linux-mips/list/',
 'PATH_TRANSLATED': None,
 'QUERY_STRING': '=Blah&submitter=999',
 'REMOTE_ADDR': '91.19.196.55',
 'REMOTE_HOST': None,
 'REMOTE_IDENT': None,
 'REMOTE_USER': None,
 'REQUEST_METHOD': 'GET',
 'SCRIPT_NAME': '',
 'SERVER_NAME': 'patchwork.linux-mips.org',
 'SERVER_PORT': 443,
 'SERVER_PROTOCOL': 'HTTP/1.1',
 'SERVER_SOFTWARE': 'mod_python'}>

  Ralf


More information about the Patchwork mailing list