Ticket #18575: 18575-2.diff

File 18575-2.diff, 1.1 KB (added by Claude Paroz, 6 years ago)

Removed kwargs changes from the previous patch

  • django/test/signals.py

    diff --git a/django/test/signals.py b/django/test/signals.py
    index 5b0a9a1..4764bd2 100644
    a b import os 
    22import time
    33
    44from django.conf import settings
    5 from django.db import connections
    65from django.dispatch import receiver, Signal
    76from django.utils import timezone
    87
    setting_changed = Signal(providing_args=["setting", "value"]) 
    1615
    1716@receiver(setting_changed)
    1817def update_connections_time_zone(**kwargs):
     18    if kwargs['setting'] not in ('USE_TZ', 'TIME_ZONE'):
     19        return
    1920    if kwargs['setting'] == 'TIME_ZONE':
    2021        # Reset process time zone
    2122        if hasattr(time, 'tzset'):
    def update_connections_time_zone(**kwargs): 
    2829        # Reset local time zone cache
    2930        timezone._localtime = None
    3031
     32    try:
     33        from django.db import connections
     34    except ImproperlyConfigured:
     35        # No databases setup, quit
     36        return
     37
    3138    # Reset the database connections' time zone
    3239    if kwargs['setting'] == 'USE_TZ' and settings.TIME_ZONE != 'UTC':
    3340        USE_TZ, TIME_ZONE = kwargs['value'], settings.TIME_ZONE
Back to Top