Opened 15 years ago

Closed 15 years ago

Last modified 12 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 15 years ago.
9005-with-tests.diff (3.2 KB) - added by Eric Holscher 15 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)

Changed 15 years ago by Matt McDonald

Attachment: testfornone.diff added

comment:1 Changed 15 years ago by (none)

milestone: post-1.0

Milestone post-1.0 deleted

comment:2 Changed 15 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:3 Changed 15 years ago by Bob Thomas

Has patch: set

comment:4 Changed 15 years ago by Eric Holscher

Needs tests: set

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

Changed 15 years ago by Eric Holscher

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 Changed 15 years ago by Alex Gaynor

Needs tests: unset
Triage Stage: AcceptedReady for checkin

comment:6 Changed 15 years ago by Jacob

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 Changed 12 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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