def UrlRequired(function):
@wraps(function)
def wrap(request, *args, **kwargs):
if 'id' in request.session and 'url' not in request.session:
request.session.delete()
return HttpResponseRedirect('/home/')
else:
return function(request, *args, **kwargs)
return wrap
这是我的自定义装饰器,我正在传递项目级别的URL,因此所有扩展相应URL的函数都可以使用它,但它给出了此类错误。
TypeError at /home/
'tuple' object is not callable
url:
url(r'home/',UrlRequired(include('app.urls',namespace='homee'))),