[Zope3-Users] obtaining time zone from http request

Stephan Richter srichter at cosmos.phy.tufts.edu
Sun Aug 28 22:59:27 EDT 2005


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. Requests know 
only about the locale. But the locale can be applicable in multiple 
timezones. However, the locale usually knows about the timezones that are 
part of the locale. The object ``request.locale.dates.timezones`` is a 
mapping from timezone names (in the ICU format) to 
``zope.i18n.interfaces.locales.ITimeZone`` objects.

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 version, which 
is much better with timezones as far as I remember.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list