#9581 closed enhancement (fixed)
Documentation page for TracIni should list or have reference to allowed values for default_timezone
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | high | Milestone: | 1.0 |
Component: | general | Version: | 0.12dev |
Severity: | normal | Keywords: | bitesized, patch |
Cc: | Branch: | ||
Release Notes: |
admin: the default timezone and default language can be set in the "Basic Settings" panel |
||
API Changes: | |||
Internal Changes: |
Description
I had a bit of a difficult time figuring out what are the valid values for the default_timezone option in the [trac] section of trac.ini. It seems like the allowed values should be documented at TracIni#trac-section, or an external reference pointed to.
Another option might be to add it to Basic Settings section of the WebAdmin panel and allow a drop down list of allowed values.
Attachments (5)
Change History (22)
follow-up: 2 comment:1 by , 14 years ago
Keywords: | bitesized added |
---|---|
Milestone: | → unscheduled |
comment:2 by , 14 years ago
Replying to rblank:
Except for the "GMT +xx:xx" zones, the names are defined in pytz, so we can't just list them in the documentation. We could list the GMT+offset zones, and provide a link to the pytz documentation.
I searched around but couldn't find a list of names in the pytz documentation. There is described a way to generate them, which could be pointed to in the Trac docs, or perhaps there is some way to use this pytz function to generate output for the Trac docs.
Then again, an entry in the "Basic Settings" sounds nice, too, and we already have the necessary code in the user preferences, so it shouldn't be too difficult.
I'll have a first cut at a patch for this ready by this evening.
by , 14 years ago
Attachment: | BasicSettings.png added |
---|
comment:3 by , 14 years ago
Is default_timezone a property of some object, like project_name can be accessed in self.env.project_name? I've spent some time looking at localtz in trac.utils.datefmt, and also calling self.config.get('trac', 'default_timezone') within render_admin_panel. It doesn't seem to be behaving well, so I thinking I'm doing this wrong.
I added the select list to the Basic Settings panel at the following position:
follow-up: 5 comment:4 by , 14 years ago
The default_timezone
option is defined in RequestDispatcher. You can get and set the value via this property, or go through self.config
if it's easier. What do you mean with "doesn't seem to be behaving well"? Don't hesitate to post a patch (even incomplete).
The place where you put the selector looks fine.
comment:5 by , 14 years ago
Replying to rblank:
What do you mean with "doesn't seem to be behaving well"? Don't hesitate to post a patch (even incomplete).
I'm struggling a bit with passing data between the template and render_admin_panel. I'll spend a little bit of time with it tomorrow morning, and then post what I have so far (and also spend some time testing your revised patch in #9582 at that time). Thanks!
comment:6 by , 14 years ago
Here is my first cut at a patch. The main question I have is over the use of pytz objects vs strings. Since all_timezones
is a list of strings, I've coded it so that the template does a string comparison and returns a string. However, default_timezone
is a pytz object. It seemed safer to pass the string value to get_timezone
since it seems to handle the error checking.
I looked at the code in prefs_datetime.html, but did things a bit differently. It seems like the following code is overly complicated. For example, I'm not sure why settings.session.get('tz') would be called from the template rather than passing a value for session_tzname from PreferencesModule.render_preference_panel.
<div class="field" py:with="session_tzname = settings.session.get('tz'); selected_tz = timezone(session_tzname) or utc"> <label>Time zone: <select name="tz"> <option value="None">Default time zone</option> <option py:for="tzname in timezones" value="${tzname}" selected="${session_tzname != None and session_tzname.startswith('Etc/') and selected_tz == timezone(tzname) or session_tzname == tzname or None}">${tzname}</option> </select></label>
by , 14 years ago
Attachment: | t9581-r10056.patch added |
---|
by , 14 years ago
Attachment: | PrefsPanelText2.png added |
---|
by , 14 years ago
Attachment: | PrefsPanelText1.png added |
---|
comment:7 by , 14 years ago
follow-up: 9 comment:8 by , 14 years ago
Milestone: | unscheduled → 0.13 |
---|---|
Owner: | set to |
Looks good at first sight. One comment, though: placing the content of <textarea>
fields on a new line is intentional, as it fixes an issue with IE (I can't find the relevant ticket ATM, but I'm sure Christian will chime in). Please don't change those.
comment:9 by , 14 years ago
comment:10 by , 14 years ago
Priority: | normal → high |
---|
comment:11 by , 14 years ago
Keywords: | needfixup added |
---|
by , 14 years ago
Attachment: | 9581-default-tz-lang-r10162.patch added |
---|
Configure default timezone and language in admin panel.
comment:12 by , 14 years ago
9581-default-tz-lang-r10162.patch is a reworked version of your patch, and (while I was at it) also adds a select box for the default language. Testing welcome.
About comment:7, I can't reproduce that with current trunk, but it may have been fixed in [10160]. If this is still happening for you, please provide the value of [trac] default_timezone
on your system, as well as your version of pytz (if installed).
comment:13 by , 14 years ago
Keywords: | patch added; needfixup removed |
---|
comment:14 by , 14 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Patch applied in [10178]. Thanks Ryan for your excellent patch!
comment:15 by , 14 years ago
Owner: | changed from | to
---|
comment:16 by , 14 years ago
Thanks for revising and applying the patch! Normally I'd be able to help test it out in the few days you made available, but have been exceptionally busy lately. On to the next ticket soon I hope …
comment:17 by , 14 years ago
Release Notes: | modified (diff) |
---|
Except for the "GMT +xx:xx" zones, the names are defined in pytz, so we can't just list them in the documentation. We could list the GMT+offset zones, and provide a link to the pytz documentation.
Then again, an entry in the "Basic Settings" sounds nice, too, and we already have the necessary code in the user preferences, so it shouldn't be too difficult.