Django 1.9 + DRF causing strange issues

36 views
Skip to first unread message

joe.s...@talktopebble.co.uk

unread,
Feb 19, 2016, 8:55:45 AM2/19/16
to Django users
Hi,

I'm having a strange issue with Django 1.9 and Django Rest Framework 3.3. Most of the upgrade went well apart from one endpoint failing for a reason I can't figure out myself.

Here's the traceback:

Traceback (most recent call last):
  File "/home/ubuntu/something/sfm/somethingelse/tests/test_account.py", line 54, in test_get_banks
    response = self.client.get(reverse('somethingelse-settlement-list'))
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/test/client.py", line 503, in get
    **extra)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/test/client.py", line 304, in get
    return self.generic('GET', path, secure=secure, **r)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/test/client.py", line 380, in generic
    return self.request(**r)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/test/client.py", line 467, in request
    six.reraise(*exc_info)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 174, in get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 172, in get_response
    response = response.render()
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/template/response.py", line 160, in render
    self.content = self.rendered_content
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/rest_framework/response.py", line 71, in rendered_content
    ret = renderer.render(self.data, media_type, context)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/rest_framework/renderers.py", line 172, in render
    return template_render(template, context, request=request)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/rest_framework/compat.py", line 232, in template_render
    return template.render(context, request=request)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/template/backends/django.py", line 92, in render
    context = make_context(context, request)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/template/context.py", line 291, in make_context
    context.push(original_context)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/template/context.py", line 61, in push
    return ContextDict(self, *dicts, **kwargs)
  File "/home/ubuntu/virtualenvs/venv-system/local/lib/python2.7/site-packages/django/template/context.py", line 20, in __init__
    super(ContextDict, self).__init__(*args, **kwargs)
ValueError: dictionary update sequence element #0 has length 5; 2 is required

Thanks in advance if anyone knows what's going on.

Legal status: Any views or opinions are solely those of the sender and do not necessarily represent those of SF Software Ltd unless expressly stated in the body of the text of the email, this email is not intended to form a binding contract.

Confidentiality: this communication may contain information that is confidential and/or privileged and is for the exclusive use of the intended recipient(s). Any form of distribution, copying or use of this communication by anyone else is strictly prohibited. If you have received this communication in error, please reply to this message or telephone +44 (0)845 310 1788 and delete this communication and destroy any copies. 

Security: this communication has been created and sent in the knowledge that internet e-mail is not secure. We strongly advise you to understand and to be aware of the lack of security when e-mailing us. If you communicate with us via e-mail, we will assume that you accept the security risk and that you authorise us to communicate with you in the same format. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. 

Warning: Although we take reasonable precautions to ensure no viruses are present in this email, we cannot accept responsibility for any loss or damage arising from the use of this email or attachments. 
-----------------------------------------------------------------------------------------------------------------
In compliance with Directive on Disclosure, The Companies Regulations 2006, effective 01 January 2007 talktopebble.co.uk,schoolfund.co.ukschoolfundfinder.co.ukeasyusbooks.co.ukclubfund.co.uk are domain names registered to SF Software Limited.

SF Software Limited is a company registered in England and Wales with company number: 05580540. Our trading name is Pebble our trading address and registered office is: Media Exchange Three, Coquet Street, Newcastle upon Tyne, NE1 2QB
VAT Registration number is: GB 873 5186 95

James Schneider

unread,
Feb 19, 2016, 2:53:21 PM2/19/16
to django...@googlegroups.com
On Fri, Feb 19, 2016 at 5:51 AM, <joe.s...@talktopebble.co.uk> wrote:
Hi,

I'm having a strange issue with Django 1.9 and Django Rest Framework 3.3. Most of the upgrade went well apart from one endpoint failing for a reason I can't figure out myself.

Here's the traceback:

Traceback (most recent call last):
  File "/home/ubuntu/something/sfm/somethingelse/tests/test_account.py", line 54, in test_get_banks
    response = self.client.get(reverse('somethingelse-settlement-list'))


Can you run the shell and see what the result of reverse('somethingelse-settlement-list')? 

Also, this SO post seems to have a resolution for this problem: https://github.com/tomchristie/django-rest-framework/issues/1295

Looks to be an issue between reverse and the setup in urls.py. 

-James 

James Schneider

unread,
Feb 19, 2016, 2:54:35 PM2/19/16
to django...@googlegroups.com

Also, this SO post seems to have a resolution for this problem: https://github.com/tomchristie/django-rest-framework/issues/1295


Whoops... 

s/SO post/Github issue/

-James
Reply all
Reply to author
Forward
0 new messages