Edgewall Software
Modify

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#9581 closed enhancement (fixed)

Documentation page for TracIni should list or have reference to allowed values for default_timezone

Reported by: ryano@… Owned by: Ryan J Ollos <ryano@…>
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)

BasicSettings.png (16.6 KB ) - added by Ryan J Ollos <ryano@…> 14 years ago.
t9581-r10056.patch (3.0 KB ) - added by Ryan J Ollos <ryano@…> 14 years ago.
PrefsPanelText2.png (22.9 KB ) - added by Ryan J Ollos <ryano@…> 14 years ago.
PrefsPanelText1.png (22.1 KB ) - added by Ryan J Ollos <ryano@…> 14 years ago.
9581-default-tz-lang-r10162.patch (7.6 KB ) - added by Remy Blank 14 years ago.
Configure default timezone and language in admin panel.

Download all attachments as: .zip

Change History (22)

comment:1 by Remy Blank, 14 years ago

Keywords: bitesized added
Milestone: unscheduled

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.

in reply to:  1 comment:2 by Ryan Ollos <ryano@…>, 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 Ryan J Ollos <ryano@…>, 14 years ago

Attachment: BasicSettings.png added

comment:3 by Ryan J Ollos <ryano@…>, 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:

comment:4 by Remy Blank, 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.

in reply to:  4 comment:5 by Ryan J Ollos <ryano@…>, 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 Ryan J Ollos <ryano@…>, 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 Ryan J Ollos <ryano@…>, 14 years ago

Attachment: t9581-r10056.patch added

by Ryan J Ollos <ryano@…>, 14 years ago

Attachment: PrefsPanelText2.png added

by Ryan J Ollos <ryano@…>, 14 years ago

Attachment: PrefsPanelText1.png added

comment:7 by Ryan J Ollos <ryano@…>, 14 years ago

I also think there may be a small problem with the Preferences: Date & Time panel. If I leave the Default time zone selected in the listbox and repeatedly hit Save, the text below the listbox toggles between:


The difference is the third line of text.

comment:8 by Remy Blank, 14 years ago

Milestone: unscheduled0.13
Owner: set to Remy Blank

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.

in reply to:  8 comment:9 by Christian Boos, 14 years ago

Replying to rblank:

placing the content of <textarea> fields on a new line is intentional, as it fixes an issue with IE

Right, see #7657 and especially r3496 for a discussion of the problem.

comment:10 by Remy Blank, 14 years ago

Priority: normalhigh

comment:11 by Christian Boos, 14 years ago

Keywords: needfixup added

by Remy Blank, 14 years ago

Configure default timezone and language in admin panel.

comment:12 by Remy Blank, 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 Remy Blank, 14 years ago

Keywords: patch added; needfixup removed

comment:14 by Remy Blank, 14 years ago

Resolution: fixed
Status: newclosed

Patch applied in [10178]. Thanks Ryan for your excellent patch!

comment:15 by Remy Blank, 14 years ago

Owner: changed from Remy Blank to Ryan J Ollos <ryano@…>

comment:16 by Ryan Ollos <ryano@…>, 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 Christian Boos, 14 years ago

Release Notes: modified (diff)

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Ryan J Ollos <ryano@…>.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Ryan J Ollos <ryano@…> to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.