#10678 closed (duplicate)
Confusing error when django.root has a trailing slash
Reported by: | Rick Dean | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Keywords: | django.root mod_python | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If using mod_python, and django.root has a trailing
slash, then some pages fail with a confusing "NoneType
is not iterable" error on line 82 of core/handlers/base.py
because request.path_info is None. The following patch
fixes it by silently truncating the configurable.
Also, can we please add double quotes around the value
of example django.root setting on
http://docs.djangoproject.com/en/dev/howto/deployment/modpython/
Attachments (2)
Change History (7)
by , 16 years ago
comment:1 by , 16 years ago
milestone: | → 1.1 |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 16 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
I can't reproduce this problem with or without the patch. The fact that "some page fail" indicates that it's not something this cut and dry. Also, note that the lines following guard against an empty path_info
(line 33) so just striping the slash won't change that.
I'm marking worksforme; please feel free to reopen if you find more information.
comment:3 by , 15 years ago
Keywords: | django.root mod_python added |
---|---|
milestone: | 1.1 → 1.2 |
Resolution: | worksforme |
Status: | closed → reopened |
I can consistently induce a similar error by setting django.root to simply '/'. Here's the maddening Traceback:
Mod_python error: "PythonHandler django.core.handlers.modpython" Traceback (most recent call last): File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 299, in HandlerDispatch result = object(req) File "/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py", line 230, in handler return ModPythonHandler()(req) File "/usr/lib/python2.4/site-packages/django/core/handlers/modpython.py", line 203, in __call__ response = self.get_response(request) File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py", line 115, in get_response return debug.technical_404_response(request, e) File "/usr/lib/python2.4/site-packages/django/views/debug.py", line 247, in technical_404_response tried = exception.args[0]['tried'] KeyError: 'tried'
I admit that setting django.root to '/' was a mistake, but this took me over an hour to track down. I'd like to help out others who might make the same mistake. I'll attach a patch that raises an exception when a bad django.root is used.
by , 15 years ago
Attachment: | django-10678.diff added |
---|
Alternative patch raising ValueError when a bad django.root is configured
comment:4 by , 15 years ago
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Duplicate of #9270. Anybody putting django.root = "/"
hasn't read the documentation for how django.root
is being used, by the way. It's never required.
patch to correct bad configurable values