Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#9005 closed (fixed)

url templatetag incorrectly assumes settings.SETTINGS_MODULE is not set to None

Reported by: Matt McDonald Owned by: nobody
Component: Template system Version: dev
Severity: Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

When rolling your own config using conf.settings.configure() instead of the DJANGO_SETTINGS_MODULE environment variable, settings.SETTINGS_MODULE gets set to None. Any code which assumes that settings.SETTINGS_MODULE has been set to a string would be incorrect.

I've attached a patch to fix an occurrence of this issue in the url templatetag which currently causes an AttributeError: 'NoneType' object has no attribute 'split'.

Attachments (2)

testfornone.diff (1.2 KB ) - added by Matt McDonald 16 years ago.
9005-with-tests.diff (3.2 KB ) - added by Eric Holscher 16 years ago.
Patch with tests. Fails on trunk with above-mentioned error, passed with patch with correct lack of url resolution.

Download all attachments as: .zip

Change History (9)

by Matt McDonald, 16 years ago

Attachment: testfornone.diff added

comment:1 by (none), 16 years ago

milestone: post-1.0

Milestone post-1.0 deleted

comment:2 by Jacob, 16 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 by Bob Thomas, 16 years ago

Has patch: set

comment:4 by Eric Holscher, 16 years ago

Needs tests: set

This code needs to have a test associated with it so that this functionality doesn't happen again.

by Eric Holscher, 16 years ago

Attachment: 9005-with-tests.diff added

Patch with tests. Fails on trunk with above-mentioned error, passed with patch with correct lack of url resolution.

comment:5 by Alex Gaynor, 16 years ago

Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:6 by Jacob, 16 years ago

Resolution: fixed
Status: newclosed

(In [10351]) [1.0.X] Fixed #9005: don't wig out when reversing a URL if SETTINGS_MODULE isn't set. While I was there, I fixed #10599 by re-raising the original error message, which is almost always a better idea. Thanks, Eric. Backport of r10350 from trunk.

comment:5 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

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