Opened 15 years ago

Closed 14 years ago

Last modified 12 years ago

#10130 closed (fixed)

Support setting deletion

Reported by: Joost Cassee Owned by: Joost Cassee
Component: Core (Other) Version: dev
Severity: Keywords: settings
Cc: Ben Spaulding 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

The LazySettings class supports setting and getting options, but not deleting them. Apart from the obvious symmetry, the very useful TestSettingsManager class from this snippet (which changes settings temporarily for tests) requires it.

The attached patch adds a __delattr__ method. Please consider applying it.

Attachments (3)

10130-r9791.diff (807 bytes ) - added by Joost Cassee 15 years ago.
10130-r10407.diff (1.8 KB ) - added by Joost Cassee 15 years ago.
10130-r11594.diff (1.6 KB ) - added by Joost Cassee 14 years ago.
Remember to also add init.py and models.py to test directory.

Download all attachments as: .zip

Change History (17)

by Joost Cassee, 15 years ago

Attachment: 10130-r9791.diff added

comment:1 by dc, 15 years ago

You shouldn't alter settings in your applications at runtime.

http://docs.djangoproject.com/en/dev/topics/settings/#altering-settings-at-runtime

in reply to:  1 comment:2 by Joost Cassee, 15 years ago

Replying to dc:

You shouldn't alter settings in your applications at runtime.

I agree -- in theory. In practice I have an application of which the behaviour is dependent on settings, that I want to test.

comment:3 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

comment:4 by Eric Holscher, 15 years ago

Needs tests: set

Need to provide tests.

comment:5 by Jacob, 15 years ago

milestone: 1.11.2

comment:6 by Joost Cassee, 15 years ago

Needs tests: unset

Apparently a recent change broke the attached patch. The new one includes a trivial patch.

by Joost Cassee, 15 years ago

Attachment: 10130-r10407.diff added

comment:7 by Chris Beaven, 15 years ago

Patch needs improvement: set

Should test the '_wrapped' special case too - and I'd suggest that it should be raising AttributeError.

by Joost Cassee, 14 years ago

Attachment: 10130-r11594.diff added

Remember to also add init.py and models.py to test directory.

comment:8 by Joost Cassee, 14 years ago

Needs tests: set
Patch needs improvement: unset

Updated patch following SmileyChris' suggestions.

comment:9 by Joost Cassee, 14 years ago

Needs tests: unset
Owner: changed from nobody to Joost Cassee

comment:10 by Chris Beaven, 14 years ago

Triage Stage: AcceptedReady for checkin

comment:11 by Ben Spaulding, 14 years ago

Cc: Ben Spaulding added

comment:12 by Jacob, 14 years ago

Resolution: fixed
Status: newclosed

(In [11824]) FIxed #10130: you may now delete attributes on settings. Thanks, jcassee.

comment:13 by Jacob, 14 years ago

(In [11825]) [1.1.X] Fixed #10130: you may now delete attributes on settings. Thanks, jcassee.

Backport of r11824.

comment:14 by Jacob, 12 years ago

milestone: 1.2

Milestone 1.2 deleted

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