google-code-export / dojango

Automatically exported from code.google.com/p/dojango
Other
1 stars 0 forks source link

Stale version of TIME_INPUT_FORMATS used by dojango.form.fields.TimeField #62

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Reason:
Dojango overwrites dj_settings.TIME_INPUT_FORMATS, but doesn't clear cache 
"_format_cache" of django.utils.formats.get_format().

Details:
If get_format(TIME_INPUT_FORMATS) is called before D-o-jango overwrites 
dj_settings.TIME_INPUT_FORMATS, "_format_cache" is filled with Django default 
value, and this value is returned for every subsequent call of 
get_format(TIME_INPUT_FORMATS), no matter what actual settings value will be at 
calling time.

What version of the product are you using? On what operating system?

Django trunk, Dojango 0.5.1 final

Original issue reported on code.google.com by zim...@gmail.com on 27 Dec 2010 at 1:11

GoogleCodeExporter commented 9 years ago
Could you provide a fix for that issue?

Original comment by tobias.k...@googlemail.com on 27 Dec 2010 at 1:39

GoogleCodeExporter commented 9 years ago
Django docs suggest that "You shouldn't alter settings in your applications at 
runtime.". If we accept this rule, Dojango README should encourage users to add 
Dojango's TIME_INPUT_FORMATS manually.
Otherwise, the only solution I see is to clear 
django.utils.formats._format_*cache, after modifying the settings at runtime.

I'm voting for the first option.

Original comment by zim...@gmail.com on 31 Jan 2011 at 1:23

GoogleCodeExporter commented 9 years ago
Should be fixed in r286.

Original comment by tobias.k...@googlemail.com on 14 Apr 2011 at 10:09