1038: Add time zone to settings page.

eric****@gmai***** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
April 22, 2009
It would be nice if in the admin settings page there was a field to change
the django TIME_ZONE variable.  As far as I can tell, the only way to set
it is to update the reviewboard/conf/settings_local.py file.

Bonus points if individual users can change their timezone, and include the
timezone in the timestamps (we have developers spread over the
globe...maybe they're used to funky timestamps, but I think it would bug me).
chipx86
#1 chipx86
Can try to get it in for 1.0. Might slip.
  • +Confirmed
  • -Priority-Medium
    +Priority-Low
    +Milestone-Release1.0
    +Component-Settings
chipx86
#2 chipx86
  • -Type-Defect
    +Type-Enhancement
chipx86
#3 chipx86
Added in r1925.
  • -Confirmed
    +Fixed
  • +chipx86
#4 eric****@gmai***** (Google Code) (Is this you? Claim this profile.)
This doesn't quite work for me.  Changing the value doesn't seem to make any impact.
 I've tried to unravel it because it seems like there are a couple of issues.

1. There appears to be a bug in djblets/siteconfig/django_settings.py.  TIME_ZONE is
listed twice, and I think it is referencing the one with locale_time_zone which is
incorrect (admin/forms.py is locale_timezone without an underscore).  I'm not exactly
sure which one is correct, it's not clear to me how djblets is updating
django.conf.settings.

2. Due to the way the timezone is set (in django.conf it updates os.environ['TZ'] and
calls tzset), it's not picking up the change due to the way djblets is overriding
django.conf.settings.  In the debugger, I can see django.conf.settings.TIME_ZONE is
correct (after fixing the issue in #1), but os.environ['TZ'] is not updated.  It
doesn't work even if I restart the webserver.
chipx86
#5 chipx86
Try upgrading your Djblets. Both issues were fixed the same day this went in. I
probably just screwed up on setting the dependency for the new version.
#6 eric****@gmai***** (Google Code) (Is this you? Claim this profile.)
I think I have the latest (r12061).  I can at least see in django_settings.py that in
apply_django_settings it's going to matter what order the two TIME_ZONE settings show
up (it takes the last value).  So if it happens to come out of the dictionary as 

'locale_timezone':             { 'key': 'TIME_ZONE',
                                     'deserialize_func': str },
'locale_time_zone':            'TIME_ZONE',

or

'locale_time_zone':            'TIME_ZONE',
'locale_timezone':             { 'key': 'TIME_ZONE',
                                     'deserialize_func': str },

the last one will win.  It happens to come out in the right order on my system (the
second case), but that is not very reliable.

Also, due to the way that the siteconfig middleware works, just setting TIME_ZONE on
the django settings object will not affect the system timezone.  The Settings object
only does that during __init__.  It will need to update the environment variable and
call tzset somehow.
chipx86
#7 chipx86
Okay, so I use git for my management, and it looks like I accidentally committed to
"master" instead of my topic branch for this. So I saw it on "master" and assumed
that meant I pushed it to SVN, which I didn't. I just now took care of this, and it
should be fixed in r12062. Let me know if you hit any issues.
#8 eric****@gmai***** (Google Code) (Is this you? Claim this profile.)
Ah, that's it.  That works, thanks!
#9 birb****@gmai***** (Google Code) (Is this you? Claim this profile.)
So far there is only one global setting in the admin page.
Are there any plans on having per-user timezones?

That would be very useful for cross-world developement.
#10 paul****@gmai***** (Google Code) (Is this you? Claim this profile.)
Any plans for implementing per-user timezones?
Should separate issue be created for this?
david
#11 david
Yes, we have plans for this (and some experimental code). We don't need a separate issue.