Ticket #17882: 17882-better-fix-with-setting-changed-signal.diff
File 17882-better-fix-with-setting-changed-signal.diff, 764 bytes (added by , 13 years ago) |
---|
-
django/test/signals.py
1 from django.db import close_connection 1 2 from django.dispatch import Signal 2 3 3 4 template_rendered = Signal(providing_args=["template", "context"]) … … 3 4 4 5 setting_changed = Signal(providing_args=["setting", "value"]) 6 7 # Close the database connection to re-establish it with the proper time zone. 8 def close_connection_on_time_zone_change(**kwargs): 9 if (kwargs['setting'] == 'USE_TZ' 10 or (kwargs['setting'] == 'TIME_ZONE' and not settings.USE_TZ)): 11 close_connection() 12 setting_changed.connect(close_connection_on_time_zone_change)