ztfy/utils/timezone.py
changeset 37 393fad193b6b
parent 36 14084f98ac50
child 38 9571328b05d2
--- a/ztfy/utils/timezone.py	Tue Mar 02 23:36:04 2010 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2008 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""
-
-$Id: $
-"""
-
-__version__ = "$Revision: $"
-__release__ = "$Id: $"
-__docformat__ = "restructuredtext"
-
-# import standard packages
-import pytz
-
-# import Zope3 interfaces
-from zope.interface.common.idatetime import ITZInfo
-from zope.publisher.interfaces.browser import IBrowserRequest
-
-# import local interfaces
-
-# import Zope3 packages
-from zope.component import adapter
-from zope.interface import implementer
-
-# import local packages
-
-
-GMT = pytz.timezone('GMT')
-_tz = pytz.timezone('Europe/Paris')
-tz = _tz
-
-@implementer(ITZInfo)
-@adapter(IBrowserRequest)
-def tzinfo(request=None):
-    return tz
-
-
-def tztime(value):
-    if not value:
-        return None
-    if not value.tzinfo:
-        value = GMT.localize(value)
-    return value.astimezone(tz)
-
-
-def gmtime(value):
-    if not value:
-        return None
-    if not value.tzinfo:
-        value = GMT.localize(value)
-    return value.astimezone(GMT)