Fantomas42 / django-blog-zinnia

Simple yet powerful and really extendable application for managing a blog within your Django Web site.
http://django-blog-zinnia.com/
BSD 3-Clause "New" or "Revised" License
2.12k stars 730 forks source link

TypeError __nonzero__ should return bool or int, returned instancemethod #337

Closed ziweizhou closed 10 years ago

ziweizhou commented 10 years ago

Hi

I am using django-cms 3.0beta and zinnia 0.15.dev. I got following error when I am trying to access it from the admin page.

TypeError at /weblog/2014/03/13/test-123/
__nonzero__ should return bool or int, returned instancemethod
Request Method: GET
Request URL:    http://tourguide-test.triosky.com/weblog/2014/03/13/test-123/
Django Version: 1.6.2
Exception Type: TypeError
Exception Value:    
__nonzero__ should return bool or int, returned instancemethod
Exception Location: /sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/defaulttags.py in render, line 304
Python Executable:  /sites/.virtualenvs/tour/bin/python
Python Version: 2.7.3
Python Path:    
['/sites/trip/code/django-tourguide',
 '/sites/.virtualenvs/tour/bin',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/translate_toolkit-1.11.0-py2.7.egg',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/djangocms_admin_style-0.2.0-py2.7.egg',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django_sekizai-0.7-py2.7.egg',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/html5lib-1.0b3-py2.7.egg',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django_classy_tags-0.5-py2.7.egg',
 '/sites/.virtualenvs/tour/lib/python2.7',
 '/sites/.virtualenvs/tour/lib/python2.7/plat-linux2',
 '/sites/.virtualenvs/tour/lib/python2.7/lib-tk',
 '/sites/.virtualenvs/tour/lib/python2.7/lib-old',
 '/sites/.virtualenvs/tour/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/sites/.virtualenvs/tour/local/lib/python2.7/site-packages']
Server time:    Thu, 13 Mar 2014 02:54:44 +0000
Fantomas42 commented 10 years ago

Hello,

Without traceback, I can do nothing for you. And django-cms 3.0beta is not tested with Zinnia or cmsplugin-zinnia, because I don't have the time to support beta versions.

Because this issue don't happen with the django-cms 2.x releases, report the issue on their page.

ziweizhou commented 10 years ago

Sorry, following is the traceback, if you think that I should post on their website, I will do that as well. Thanks for your help

LINE 79 : {% if perms.zinnia %} got the error.

Environment:

Request Method: GET
Request URL: http://tourguide-test.triosky.com/en/blog/?edit_off

Django Version: 1.6.2
Python Version: 2.7.3
Installed Applications:
('djangocms_admin_style',
 'djangocms_text_ckeditor',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.sites',
 'django.contrib.comments',
 'south',
 'rest_framework',
 'slugify',
 'sorl.thumbnail',
 'debug_toolbar',
 'customauth',
 'tours',
 'photos',
 'trips',
 'geowiki',
 'rosetta',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'allauth.socialaccount.providers.weibo',
 'cms',
 'mptt',
 'menus',
 'sekizai',
 'raven.contrib.django.raven_compat',
 'reversion',
 'storages',
 'djangocms_style',
 'djangocms_column',
 'djangocms_inherit',
 'djangocms_link',
 'djangocms_twitter',
 'filer',
 'cmsplugin_filer_file',
 'cmsplugin_filer_folder',
 'cmsplugin_filer_image',
 'cmsplugin_filer_teaser',
 'cmsplugin_filer_video',
 'tagging',
 'zinnia',
 'cmsplugin_zinnia')
Installed Middleware:
('raven.contrib.django.raven_compat.middleware.SentryResponseErrorIdMiddleware',
 'raven.contrib.django.raven_compat.middleware.Sentry404CatchMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.locale.LocaleMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'debug_toolbar.middleware.DebugToolbarMiddleware',
 'django.middleware.doc.XViewMiddleware',
 'cms.middleware.page.CurrentPageMiddleware',
 'cms.middleware.user.CurrentUserMiddleware',
 'cms.middleware.toolbar.ToolbarMiddleware',
 'cms.middleware.language.LanguageCookieMiddleware')

Template error:
In template /sites/.virtualenvs/tour/local/lib/python2.7/site-packages/zinnia/templates/zinnia/base.html, error at line 79
   __nonzero__ should return bool or int, returned instancemethod
   69 :   {% get_popular_entries %}

   70 : </div>

   71 : <div id="widget-archives" class="widget">

   72 :   <h3>{% trans "Archives" %}</h3>

   73 :   {% get_archives_entries_tree %}

   74 : </div>

   75 : {% if user.is_authenticated %}

   76 : <div id="widget-tools" class="widget">

   77 :   <h3>{% trans "Tools" %}</h3>

   78 :   <ul>

   79 :      {% if perms.zinnia %} 

   80 :     <li>

   81 :       <a href="{% url 'admin:app_list' 'zinnia' %}" title="{% trans "Dashboard" %}">

   82 :         {% trans "Dashboard" %}

   83 :       </a>

   84 :     </li>

   85 :     {% endif %}

   86 :     {% if perms.zinnia.add_entry %}

   87 :     <li>

   88 :       <a href="{% url 'admin:zinnia_entry_add' %}" title="{% trans "Post an entry" %}">

   89 :         {% trans "Post an entry" %}

Traceback:
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response
  139.                 response = response.render()
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/response.py" in render
  105.             self.content = self.rendered_content
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/response.py" in rendered_content
  82.         content = template.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  140.             return self._render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  85.     return self.nodelist.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  78.             return node.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  85.     return self.nodelist.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  78.             return node.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  85.     return self.nodelist.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  78.             return node.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  123.         return compiled_parent._render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/test/utils.py" in instrumented_test_render
  85.     return self.nodelist.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  78.             return node.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/loader_tags.py" in render
  62.             result = block.nodelist.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  78.             return node.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  305.                 return nodelist.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/base.py" in render
  840.                 bit = self.render_node(node, context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/debug.py" in render_node
  78.             return node.render(context)
File "/sites/.virtualenvs/tour/local/lib/python2.7/site-packages/django/template/defaulttags.py" in render
  304.             if match:

Exception Type: TypeError at /en/blog/
Exception Value: __nonzero__ should return bool or int, returned instancemethod
Fantomas42 commented 10 years ago

From the traceback the issue is really weird. I don't think that the cms is causing it. Certainly a problem a the project level. You have to investigate yourself for solving this issue.