加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

TypeError:'tuple' object is not callable

(2013-01-12 16:06:53)
标签:

django

pydev

typeerror

tuple

callable

it

分类: django
       django开发时:我的url.py的模式中是这样写的:
urlpatterns = patterns('',
                       (r'^time/$', current_datetime),
                       (r'^time/plus/(\d+)/$', hours_ahead),
                       (r'^search/$','mysite.books.views.search')
                       (r'^contact/$', 'mysite.books.views.contact')
而我在运行的时候,从网页登录,输入网址:http://127.0.0.1:8000/time/,却出现如下错误:


TypeError at /time/

'tuple' object is not callable
Request Method: GET
Request URL: http://127.0.0.1:8000/time/
Django Version: 1.4.1
Exception Type: TypeError
Exception Value:
'tuple' object is not callable
Exception Location: /home/liul/workspace/mysite/mysite/urls.py in , line 20
Python Executable: /usr/bin/python2.7
Python Version: 2.7.3


经过验证,原来是url中所填写的函数变量search和contact与python内部模块中的函数重名了,就会出现这种错误,所以改变这两个函数名或删掉他们就OK啦

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有