pyams_utils.timezone package ⊞

PyAMS_utils.timezone package

All datetime values should be stored in UTC to avoid any problem. Then values can be displayed to users using a specific timezone; by default, used timezone is the one specified into server settings via an IServerTimezone utility which is created automatically when initializing a new site.

There is no easy way to get user’s timezone from it’s browser settings; so the more common choice is to let users define their timezone in their profile’s settings.

pyams_utils.timezone.gmtime(value)[source]

Convert datetime to GMT

Value is assumed to be in GMT if no timezone is given

pyams_utils.timezone.localgmtime(value)[source]

Convert datetime to GMT

Value is assumed to be in server timezone if none is given

pyams_utils.timezone.tzinfo(request=None)[source]

request to timezone adapter

There is no easy way to get timezone from a request. This adapter assumes that the timezone is given by a registered utility…

pyams_utils.timezone.tztime(value)[source]

Convert datetime to local timezone

Parameters:value (datetime) – input datetime; value is assumed to be in GMT if no timezone is given

pyams_utils.timezone.utility

PyAMS_utils.timezone.utility module

class pyams_utils.timezone.utility.ServerTimezoneUtility[source]

Bases: persistent.Persistent, zope.container.contained.Contained

Server timezone utility

timezone

Server timezone: Default server timezone

pyams_utils.timezone.vocabulary

PyAMS_utils.timezone.vocabulary module

This module provides a vocabulary of available timezones

class pyams_utils.timezone.vocabulary.TimezonesVocabulary(*args, **kw)[source]

Bases: zope.schema.vocabulary.SimpleVocabulary

Timezones vocabulary