0

我正在使用 django-facebook,由于某种奇怪的原因它停止了工作。当然,我改变了一些东西,让它发生在某个地方。但正如你可能已经猜到的那样,我目前一无所知。

我收到的错误消息:

TemplateSyntaxError at /facebook/connect/

Caught TypeError while rendering: unhashable type: 'dict'

 Method:    GET
 Request URL:   http://dev.wiespeeltwaar.be/facebook/connect/
 Django Version:    1.3
 Exception Type:    TemplateSyntaxError
 Exception Value:   

 Caught TypeError while rendering: unhashable type: 'dict'

 Exception Location:    /home/jonasg/django-wiespeeltwaar/django/utils/functional.py in wrapper, line 22
 Python Executable:     /home/jonasg/.virtualenvs/wiespeeltwaar/bin/python
 Python Version:    2.6.6
 Python Path:   

 ['/home/jonasg/dev/wiespeeltwaar',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/distribute-0.6.10-py2.6.egg',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg',
  '/home/jonasg/django-wiespeeltwaar',
  '/home/jonasg/dev/wiespeeltwaar',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/plat-linux2',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/lib-tk',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/lib-old',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/lib-dynload',
  '/usr/lib/python2.6',
  '/usr/lib/python2.6/plat-linux2',
  '/usr/lib/python2.6/lib-tk',
  '/home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages']

 Server time:   zon, 11 Dec 2011 22:41:03 +0100
 Template error

 In template /home/jonasg/.virtualenvs/wiespeeltwaar/lib/python2.6/site-packages/django_facebook/templates/django_facebook/connect.html, error at line 87

 86     <!--form to call registration via facebook -->
 87     <form action="{% url facebook_connect %}?facebook_login=1" method="post">
 88     <h2>Register, login or connect with facebook</h2>

由于某种原因,url 模板标签不能给我 facebook_connect 视图的 url。

任何帮助表示赞赏!

4

2 回答 2

2

该错误实际上不在 url 标签中,只是该标签导致导入的代码有问题。在某处您尝试将字典用作字典键。

于 2011-12-11T23:06:05.803 回答
0

在您的代码中的某个地方,这很难调试。

查看堆栈跟踪:

/home/jonasg/django-wiespeeltwaar/django/utils/functional.py 在包装器中

if mem_args in cache:

    ...

▼ Local vars
Variable    Value
mem_args    

({'backend': 'wiespeeltwaar.accounts.backends.WswBackend',
  'form_class': <class 'registration.forms.RegistrationFormUniqueEmail'>},)

args    

({'backend': 'wiespeeltwaar

.accounts.backends.WswBackend',
  'form_class': <class 'registration.forms.RegistrationFormUniqueEmail'>},)

num_args    

1

cache   

{('api.views.add_loved',): <function add_loved at 0xa2bf1b4>,
 ('api.views.del_loved',): <function del_loved at 0xa2bf294>,
 ('api.views.details',): <function details at 0xa2bf064>,
 ('api.views.get_concerts',): <function get_concerts at 0xa2bf304>,
 ('api.views.loved',): <function loved at 0xa2bf17c>,
 ('api.views.search_artist',): <function search_artist at 0xa2befb4>,
 ('api.views.search_gig',): <function search_gig at 0xa2bf2cc>,
 ('api.views.set_notify_methods',): <function set_notify_methods at 0xa2bf224>,
 ('django.views.static.serve',): <function serve at 0x9b57b1c>,
 (u'facebook_connect',): 'facebook_connect',
 ('wiespeeltwaar.accounts.views.add_favartist',): <function add_favartist at 0xa2bfa3c>,
 ('wiespeeltwaar.accounts.views.del_favartist',): <function del_favartist at 0xa2bfaac>,
 ('wiespeeltwaar.accounts.views.profile',): <function profile at 0xa2bfa74>,
 ('wiespeeltwaar.gig.views.index',): <function index at 0x9f9ea3c>}

func    

<function get_callable at 0x9aba2cc>

似乎我找到了事情发生严重错误的地方。(u'facebook_connect',): 'facebook_connect', 这条线看起来完全不对!

于 2011-12-12T06:17:05.040 回答