← Back to team overview

txaws-dev team mailing list archive

[Merge] lp:~clint-fewbar/txaws/drop-zope.datetime into lp:txaws

 

Clint Byrum has proposed merging lp:~clint-fewbar/txaws/drop-zope.datetime into lp:txaws with lp:~clint-fewbar/txaws/drop-pytz as a prerequisite.

Requested reviews:
  txAWS Developers (txaws-dev)
Related bugs:
  Bug #912607 in txaws (Ubuntu): "zope.datetime should be dropped in favor of dateutil"
  https://bugs.launchpad.net/ubuntu/+source/txaws/+bug/912607

For more details, see:
https://code.launchpad.net/~clint-fewbar/txaws/drop-zope.datetime/+merge/87708

drops zope.datetime in favor of dateutil for parsing dates.
-- 
https://code.launchpad.net/~clint-fewbar/txaws/drop-zope.datetime/+merge/87708
Your team txAWS Developers is requested to review the proposed merge of lp:~clint-fewbar/txaws/drop-zope.datetime into lp:txaws.
=== modified file 'txaws/server/schema.py'
--- txaws/server/schema.py	2012-01-06 02:04:29 +0000
+++ txaws/server/schema.py	2012-01-06 02:04:29 +0000
@@ -2,8 +2,7 @@
 from operator import itemgetter
 
 from dateutil.tz import tzutc
-
-from zope.datetime import parse, SyntaxError
+from dateutil.parser import parse
 
 from txaws.server.exception import APIError
 
@@ -242,10 +241,7 @@
     kind = "date"
 
     def parse(self, value):
-        try:
-            return datetime(*parse(value, local=False)[:6], tzinfo=tzutc())
-        except (TypeError, SyntaxError):
-            raise ValueError()
+        return parse(value).replace(tzinfo=tzutc())
 
     def format(self, value):
         # Convert value to UTC.