@@ -14,6 +14,9 @@ Next release
|
|||||||
|
|
||||||
- Updated Japanese translation.
|
- Updated Japanese translation.
|
||||||
|
|
||||||
|
- Fix documentation: 0.9.3 allowed explicitly passing None to DateTime
|
||||||
|
to have no default timezone applied.
|
||||||
|
|
||||||
0.9.7 (2012-03-20)
|
0.9.7 (2012-03-20)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
@@ -1188,11 +1188,12 @@ class DateTime(SchemaType):
|
|||||||
datetime.
|
datetime.
|
||||||
|
|
||||||
The constructor accepts an argument named ``default_tzinfo`` which
|
The constructor accepts an argument named ``default_tzinfo`` which
|
||||||
should be a Python ``tzinfo`` object; by default it is None,
|
should be a Python ``tzinfo`` object. If ``default_tzinfo`` is not
|
||||||
meaning that the default tzinfo will be equivalent to UTC (Zulu
|
specified the default tzinfo will be equivalent to UTC (Zulu time).
|
||||||
time). The ``default_tzinfo`` tzinfo object is used to convert
|
The ``default_tzinfo`` tzinfo object is used to convert 'naive'
|
||||||
'naive' datetimes to a timezone-aware representation during
|
datetimes to a timezone-aware representation during serialization.
|
||||||
serialization.
|
If ``default_tzinfo`` is explicitly set to ``None`` then no default
|
||||||
|
tzinfo will be applied to naive datetimes.
|
||||||
|
|
||||||
You can adjust the error message reported by this class by
|
You can adjust the error message reported by this class by
|
||||||
changing its ``err_template`` attribute in a subclass on an
|
changing its ``err_template`` attribute in a subclass on an
|
||||||
|
@@ -1531,11 +1531,15 @@ class TestDateTime(unittest.TestCase):
|
|||||||
import datetime
|
import datetime
|
||||||
return datetime.date.today()
|
return datetime.date.today()
|
||||||
|
|
||||||
def test_ctor_default_tzinfo_None(self):
|
def test_ctor_default_tzinfo_not_specified(self):
|
||||||
from .. import iso8601
|
from .. import iso8601
|
||||||
typ = self._makeOne()
|
typ = self._makeOne()
|
||||||
self.assertEqual(typ.default_tzinfo.__class__, iso8601.Utc)
|
self.assertEqual(typ.default_tzinfo.__class__, iso8601.Utc)
|
||||||
|
|
||||||
|
def test_ctor_default_tzinfo_None(self):
|
||||||
|
typ = self._makeOne(default_tzinfo=None)
|
||||||
|
self.assertEqual(typ.default_tzinfo, None)
|
||||||
|
|
||||||
def test_ctor_default_tzinfo_non_None(self):
|
def test_ctor_default_tzinfo_non_None(self):
|
||||||
from .. import iso8601
|
from .. import iso8601
|
||||||
tzinfo = iso8601.FixedOffset(1, 0, 'myname')
|
tzinfo = iso8601.FixedOffset(1, 0, 'myname')
|
||||||
@@ -1663,6 +1667,7 @@ class TestDateTime(unittest.TestCase):
|
|||||||
node = DummySchemaNode(None)
|
node = DummySchemaNode(None)
|
||||||
result = typ.deserialize(node, iso)
|
result = typ.deserialize(node, iso)
|
||||||
self.assertEqual(result.isoformat(), dt.isoformat())
|
self.assertEqual(result.isoformat(), dt.isoformat())
|
||||||
|
self.assertEqual(result.tzinfo, None)
|
||||||
|
|
||||||
class TestDate(unittest.TestCase):
|
class TestDate(unittest.TestCase):
|
||||||
def _makeOne(self, *arg, **kw):
|
def _makeOne(self, *arg, **kw):
|
||||||
|
Reference in New Issue
Block a user