[prev in list] [next in list] [prev in thread] [next in thread]
List: zope3-checkins
Subject: [Zope3-checkins] SVN: Zope3/trunk/src/pytz/__init__.py Incorporate
From: Gary Poster <gary () zope ! com>
Date: 2005-12-20 14:48:14
Message-ID: 20051220144814.03E5920330A () mail ! zope ! org
[Download RAW message or body]
Log message for revision 40903:
Incorporate Stuart Bishop's feedback to pytz changes.
Changed:
U Zope3/trunk/src/pytz/__init__.py
-=-
Modified: Zope3/trunk/src/pytz/__init__.py
===================================================================
--- Zope3/trunk/src/pytz/__init__.py 2005-12-20 13:44:46 UTC (rev 40902)
+++ Zope3/trunk/src/pytz/__init__.py 2005-12-20 14:48:13 UTC (rev 40903)
@@ -219,6 +219,18 @@
def __repr__(self):
return 'pytz.FixedOffset(%d)' % self._minutes
+ def localize(self, dt, is_dst=False):
+ '''Convert naive time to local time'''
+ if dt.tzinfo is not None:
+ raise ValueError, 'Not naive datetime (tzinfo is already set)'
+ return dt.replace(tzinfo=self)
+
+ def normalize(self, dt, is_dst=False):
+ '''Correct the timezone information on the given datetime'''
+ if dt.tzinfo is None:
+ raise ValueError, 'Naive time - no tzinfo set'
+ return dt.replace(tzinfo=self)
+
def FixedOffset(offset, _tzinfos = {}):
"""return a fixed-offset timezone based off a number of minutes.
@@ -283,7 +295,7 @@
return info
-tzinfo.__safe_for_unpickling__ = True
+FixedOffset.__safe_for_unpickling__ = True
def _test():
import doctest, os, sys
_______________________________________________
Zope3-Checkins mailing list
Zope3-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope3-checkins
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic