On Aug 28, 2005, at 10:59 PM, Stephan Richter wrote:
On Sunday 28 August 2005 21:10, Alen Stanisic wrote:
what's the best way to obtain timezone from request object. I tried
tz = pytz.timezone(ITZInfo(self.request))
but the adaptation failed.
Getting a single time zone from the request is not sensible.
only about the locale. But the locale can be applicable in multiple
timezones. However, the locale usually knows about the timezones
part of the locale. The object ``request.locale.dates.timezones`` is a
mapping from timezone names (in the ICU format) to
Other excitement: the timezone names in the ICU database do not all
correspond to the timezones in the olson timezone database (upon
which pytz is based).
Generally, you want to let users choose their timezone. Guessing can
work like this though (Py 2.4):
ALL_TIMEZONES = frozenset(pytz.all_timezones)
for t in self.request.locale.dates.timezones.keys():
if t in ALL_TIMEZONES:
Maybe the ICU timezone object has alternate names to try in Olson; I
Unfortunately the version of the ICU data we are using does not
have very good
timezone support. At some point we need to switch to a newer
is much better with timezones as far as I remember.
I looked around at this a month or two ago and didn't see much
improvements, actually. Maybe I'm wrong.
Zope3-users mailing list