yceruto/django-ajax

dictionary update sequence element #0 has length 0; 2 is required

zruu opened this issue · 4 comments

zruu commented

I'm getting an error using the decorator on a context processor:

dictionary update sequence element #0 has length 0; 2 is required

@ajax
def new(request):
    new = Post.objects.all()[:40]
    return {'new_posts': new}

@zruu thanks for reporting this issue, you can display the full stack trace please?

zruu commented

Hey yceruto, sure. Here's the traceback:

              .....
          _d^^^^^^^^^b_
       .d''           ``b.
     .p'                `q.
    .d'                   `b.
   .d'                     `b.   * Mezzanine 4.2.0
   ::                       ::   * Django 1.10.1
  ::    M E Z Z A N I N E    ::  * Python 3.4.4
   ::                       ::   * PostgreSQL 9.5.4
   `p.                     .q'   * Darwin 15.6.0
    `p.                   .q'
     `b.                 .d'
       `q..          ..p'
          ^q........p^
              ''''

Performing system checks...

System check identified no issues (0 silenced).
September 30, 2016 - 18:00:18
Django version 1.10.1, using settings 'PROJECT.settings'
Starting development server at http://0.0.0.0:80/
Quit the server with CONTROL-C.
Internal Server Error: /
Traceback (most recent call last):
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/template/response.py", line 109, in render
    self.content = self.rendered_content
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/template/response.py", line 86, in rendered_content
    content = template.render(context, self._request)
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/template/backends/django.py", line 66, in render
    return self.template.render(context)
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/template/base.py", line 206, in render
    with context.bind_template(self):
  File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/Users/my_username/PROJECT/Dev3/lib/python3.4/site-packages/django/template/context.py", line 236, in bind_template
    updates.update(processor(self.request))
ValueError: dictionary update sequence element #0 has length 0; 2 is required

I don't see where is the related djangoajax library in your traceback, are you sure the error come from this library?? the path / route is linked to new function action ?? Please, checks that.

I closed because it doesn't seem to be related to this library, @zruu is you are still facing this issue, please reopen it. Thanks.