[RFC 0/2] Add REST API filtering/querying

Stephen Finucane stephen at that.guru
Thu Nov 17 21:57:35 AEDT 2016


On 2016-11-17 03:34, Russell Currey wrote:
> On Thu, 2016-11-17 at 01:47 +0000, Stephen Finucane wrote:
>> This requires the series REST API series.
> 
> This breaks stuff, I'm not sure why.

Because I wrote one or two filters - which worked - then copy-pasted the 
rest without testing them :) I created duplicate class names in the 
file. Maybe rename the conflicting new filters or drag all the additions 
to 'filters.py' into 'filters_new.py' and import from that? I'll push a 
new RFC tonight.

Stephen

> Environment:
> 
> Request Method: GET
> Request URL: http://<internal patchwork>/project/<project>/list/
> 
> Django Version: 1.8
> Python Version: 2.7.12
> Installed Applications:
> ['django.contrib.auth',
>  'django.contrib.contenttypes',
>  'django.contrib.humanize',
>  'django.contrib.messages',
>  'django.contrib.sessions',
>  'django.contrib.sites',
>  'django.contrib.admin',
>  'django.contrib.staticfiles',
>  'patchwork',
>  'rest_framework',
>  'django_filters']
> Installed Middleware:
> ['django.middleware.common.CommonMiddleware',
>  'django.contrib.sessions.middleware.SessionMiddleware',
>  'django.contrib.auth.middleware.AuthenticationMiddleware',
>  'django.contrib.messages.middleware.MessageMiddleware',
>  'django.middleware.csrf.CsrfViewMiddleware',
>  'django.contrib.admindocs.middleware.XViewMiddleware']
> 
> 
> Traceback:
> File "/home/patchwork/.local/lib/python2.7/site-
> packages/django/core/handlers/base.py" in get_response
>   132.                     response = wrapped_callback(request, 
> *callback_args,
> **callback_kwargs)
> File "/home/patchwork//patchwork/patchwork/views/patch.py" in patches
>   114.                            view_args={'project_id': 
> project.linkname})
> File "/home/patchwork//patchwork/patchwork/views/__init__.py" in 
> generic_list
>   196.     filters = Filters(request)
> File "/home/patchwork//patchwork/patchwork/filters.py" in __init__
>   455.         self._filters = [c(self) for c in filterclasses]
> File "/home/patchwork//patchwork/patchwork/filters.py" in __init__
>   98.         super(SeriesFilter, self).__init__(filters)
> 
> Exception Type: TypeError at /project/<project>/list/
> Exception Value: super(type, obj): obj must be an instance or subtype 
> of type
> 
>> 
>> Stephen Finucane (2):
>>   REST: Integrate django-filter support
>>   REST: Integrate searching
>> 
>>  patchwork/api/check.py     |  2 ++
>>  patchwork/api/cover.py     |  3 +++
>>  patchwork/api/patch.py     |  3 +++
>>  patchwork/api/person.py    |  2 +-
>>  patchwork/api/project.py   |  3 ++-
>>  patchwork/api/series.py    |  4 +++-
>>  patchwork/api/user.py      |  2 +-
>>  patchwork/filters.py       | 41 
>> +++++++++++++++++++++++++++++++++++++++++
>>  patchwork/settings/base.py |  8 +++++++-
>>  requirements-test.txt      |  2 +-
>>  10 files changed, 64 insertions(+), 6 deletions(-)
>> 


More information about the Patchwork mailing list