'NoneType' object has no attribute 'COOKIES'

408 views
Skip to first unread message

daniel

unread,
Oct 31, 2010, 6:25:50 PM10/31/10
to django-page-cms
hi
I'm trying to use django-page-cms in a project (thanks for writing
it!).

I created a very simple template:
"""
{% load pages_tags %}

{% block title %}TITLE{% endblock %}

{% block content %}
{% placeholder coisa-1 with WYMEditor %}
{% endblock %}
"""

I can create a page, But I got this error when displaying again the "/
admin/pages/page/":

Exception Value:
Caught AttributeError while rendering: 'NoneType' object has no
attribute 'COOKIES'
Exception Location: /usr/local/lib/python2.6/dist-packages/
django_page_cms-1.3.0-py2.6.egg/pages/templatetags/pages_tags.py in
pages_admin_menu, line 135
Template error

In template /usr/local/lib/python2.6/dist-packages/
django_page_cms-1.3.0-py2.6.egg/pages/templates/admin/pages/page/
change_list_table.html, error at line 18
Caught AttributeError while rendering: 'NoneType' object has no
attribute 'COOKIES'

18 {% for page in pages %}
19 {% pages_admin_menu page %}
20 {% endfor %}

Daniel Carvalho

unread,
Nov 1, 2010, 9:05:30 AM11/1/10
to django-page-cms
On 10/31/2010 10:25 PM, daniel wrote:
>
> I can create a page, But I got this error when displaying again the "/
> admin/pages/page/":
>
> Exception Value:
> Caught AttributeError while rendering: 'NoneType' object has no
> attribute 'COOKIES'
> Exception Location: /usr/local/lib/python2.6/dist-packages/
> django_page_cms-1.3.0-py2.6.egg/pages/templatetags/pages_tags.py in
> pages_admin_menu, line 135
> Template error

well... I changed
"django-page-cms/pages/templatetags/pages_tags.py", line 135
to:
if hasattr(request,"COOKIES") and "tree_expanded" in request.COOKIES:

And now it works!
(but I still don't know if it is a bug in page-cms or a misconfiguration
in my project settings...)


signature.asc

Batiste Bieler

unread,
Nov 1, 2010, 10:39:28 AM11/1/10
to django-...@googlegroups.com
It seems that request is None in your case... I am not sure why
request is not present.

'NoneType' object has no attribute 'COOKIES'

faden

unread,
Nov 2, 2010, 5:39:47 AM11/2/10
to django-page-cms
I made this commit, it's a bit different from what you did but should
have the same effect:

http://github.com/batiste/django-page-cms/commit/066203e96304f20ec0ab7440e787d2a93b166af8
>  signature.asc
> < 1KViewDownload
Reply all
Reply to author
Forward
0 new messages