Opened 16 years ago

Last modified 16 years ago

#7768 closed

HttpResponseRedirect causes a TypeError 'str' object is not callable in base.py — at Initial Version

Reported by: William Martinez Pomares <wmartinez@…> Owned by: nobody
Component: Core (Other) Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Working with SVN revision 7930, following the tutorial, up to the place where the votes view is created.
The line in the vote() method

return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(p.id,)))

fails presenting a debug page that says:

TypeError at /polls/1/results/
'str' object is not callable
Request Method: GET
Request URL: http://127.0.0.1:8000/polls/1/results/
Exception Type: TypeError
Exception Value: 'str' object is not callable
Exception Location: C:\Python25\lib\site-packages\django\core\handlers\base.py in get_response, line 85

I have found some relates issues (like 4700) that point to the INSTALLED_APPS settings and how the django.contrib.auth affects the get_response. I tried eliminating that application and still the error shows.
If using HttpResponseRedirect without the reverse (hardcoding the url) it fails too. If using render_to_response() instead, it works.

Another relate ticket may be 6442, but that one happens when the import error occurs. In this case the imports are ok in views.py, it is the HttpResponseRedirect that may have problems.

William Martinez.

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top