Index out of range when displaying taskstate in djcelery admin with mongodb backend #102

Open
dryf opened this Issue Jan 24, 2012 · 1 comment

Comments

Projects
None yet
2 participants

dryf commented Jan 24, 2012

Hi,

it is not possible to display celery task state when using django with MongoDB back end.

StackOverflow issue

Link to the stacktrace

Can you please fix it ?

Hi all, any luck on this? This is not specific to celery. More to MongoDB. I think it has to do more that collection is null. It's assuming there can be a cursor object. Here's the stack. Not sure where I should put this.

Request Method: GET
Request URL: http://127.0.0.1:8000/admin/someapp/someapp/

Django Version: 1.3.1
Python Version: 2.7.2
Installed Applications:
['django_mongodb_engine',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'someapp',
'djangotoolbox',
'django_mongodb_engine']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

Template error:
In template /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/templates/admin/change_list.html, error at line 79
Caught IndexError while rendering: list index out of range
69 : {% endif %}

70 : {% endblock %}

71 : {% if cl.formset.errors %}

72 :

73 : {% blocktrans count cl.formset.errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}

74 :

75 : {{ cl.formset.non_form_errors }}

76 : {% endif %}

77 :

78 : {% block search %}{% search_form cl %}{% endblock %}

79 : {% block date_hierarchy %} {% date_hierarchy cl %} {% endblock %}

80 :

81 : {% block filters %}

82 : {% if cl.has_filters %}

83 :

84 :

{% trans 'Filter' %}

85 : {% for spec in cl.filter_specs %}{% admin_list_filter cl spec %}{% endfor %}

86 :

87 : {% endif %}

88 : {% endblock %}

89 :

Traceback:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response

  1.                     response = callback(request, _callback_args, *_callback_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper
  2.             return self.admin_site.admin_view(view)(_args, *_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  3.                 response = view_func(request, _args, *_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  4.     response = view_func(request, _args, *_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner
  5.         return view(request, _args, *_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper
  6.         return bound_func(_args, *_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view
  7.                 response = view_func(request, _args, *_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func
  8.             return func(self, _args2, *_kwargs2)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/options.py" in changelist_view
  9.     ], context, context_instance=context_instance)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/shortcuts/init.py" in render_to_response
  10. return HttpResponse(loader.render_to_string(_args, *_kwargs), **httpresponse_kwargs)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py" in render_to_string
  11.     return t.render(context_instance)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  12.         return self._render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in _render
  13.     return self.nodelist.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  14.             bits.append(self.render_node(node, context))
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/debug.py" in render_node
  15.         result = node.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  16.     return compiled_parent._render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in _render
  17.     return self.nodelist.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  18.             bits.append(self.render_node(node, context))
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/debug.py" in render_node
  19.         result = node.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  20.     return compiled_parent._render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in _render
  21.     return self.nodelist.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  22.             bits.append(self.render_node(node, context))
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/debug.py" in render_node
  23.         result = node.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  24.         result = block.nodelist.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  25.             bits.append(self.render_node(node, context))
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/debug.py" in render_node
  26.         result = node.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  27.         result = block.nodelist.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  28.             bits.append(self.render_node(node, context))
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/debug.py" in render_node
  29.         result = node.render(context)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/base.py" in render
  30.                 dict = func(*args)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/contrib/admin/templatetags/admin_list.py" in date_hierarchy
  31.                                             last=models.Max(field_name))
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/query.py" in aggregate
  32.     return query.get_aggregation(using=self.db)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/models/sql/query.py" in get_aggregation
  33.     result = query.get_compiler(using).execute_sql(SINGLE)
    
    File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django_mongodb_engine-0.4.0-py2.7.egg/django_mongodb_engine/compiler.py" in execute_sql
  34.         result = cursor[0][alias] if alias else counts.pop(0)
    

Exception Type: TemplateSyntaxError at /admin/someapp/someapp/
Exception Value: Caught IndexError while rendering: list index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment