summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup.cfg2
-rw-r--r--setup.py2
-rw-r--r--src/isodate/tests/test_pickle.py6
-rw-r--r--src/isodate/tzinfo.py14
4 files changed, 23 insertions, 1 deletions
diff --git a/setup.cfg b/setup.cfg
new file mode 100644
index 0000000..2a9acf1
--- /dev/null
+++ b/setup.cfg
@@ -0,0 +1,2 @@
+[bdist_wheel]
+universal = 1
diff --git a/setup.py b/setup.py
index 44b94a6..b23acc9 100644
--- a/setup.py
+++ b/setup.py
@@ -59,7 +59,7 @@ setup(name='isodate',
description='An ISO 8601 date/time/duration parser and formatter',
license='BSD',
# keywords = '',
- url='http://cheeseshop.python.org/pypi/isodate',
+ url='https://github.com/gweis/isodate/',
long_description=(read('README.rst') +
read('CHANGES.txt') +
diff --git a/src/isodate/tests/test_pickle.py b/src/isodate/tests/test_pickle.py
index b52f8cb..d24cf4a 100644
--- a/src/isodate/tests/test_pickle.py
+++ b/src/isodate/tests/test_pickle.py
@@ -36,6 +36,12 @@ class TestPickle(unittest.TestCase):
self.assertEqual(len(failed), 0, "pickle protos failed: %s" %
str(failed))
+ def test_pickle_utc(self):
+ '''
+ isodate.UTC objects remain the same after pickling.
+ '''
+ self.assertTrue(isodate.UTC is pickle.loads(pickle.dumps(isodate.UTC)))
+
def test_suite():
'''
diff --git a/src/isodate/tzinfo.py b/src/isodate/tzinfo.py
index b41f058..573b7b8 100644
--- a/src/isodate/tzinfo.py
+++ b/src/isodate/tzinfo.py
@@ -36,10 +36,24 @@ class Utc(tzinfo):
'''
return ZERO
+ def __reduce__(self):
+ '''
+ When unpickling a Utc object, return the default instance below, UTC.
+ '''
+ return _Utc, ()
+
+
UTC = Utc()
# the default instance for UTC.
+def _Utc():
+ '''
+ Helper function for unpickling a Utc object.
+ '''
+ return UTC
+
+
class FixedOffset(tzinfo):
'''
A class building tzinfo objects for fixed-offset time zones.