def test_iso8601_datetime_formatters(): dates = [ (datetime(2011, 1, 1), "2011-01-01T00:00:00+00:00"), (datetime(2011, 1, 1, 23, 59, 59), "2011-01-01T23:59:59+00:00"), (datetime(2011, 1, 1, 23, 59, 59, tzinfo=UTC()), "2011-01-01T23:59:59+00:00"), (datetime(2011, 1, 1, 23, 59, 59, tzinfo=CET()), "2011-01-01T22:59:59+00:00"), ] for date_obj, expected in dates: yield assert_equal, inputs.iso8601(date_obj), expected
def format(self, value): try: if self.dt_format == "rfc822": return inputs.rfc822(value) elif self.dt_format == "iso8601": return inputs.iso8601(value) else: raise MarshallingException("Unsupported date format %s" % self.dt_format) except AttributeError as ae: raise MarshallingException(ae)
def format(self, value): try: if self.dt_format == 'rfc822': return inputs.rfc822(value) elif self.dt_format == 'iso8601': return inputs.iso8601(value) else: raise MarshallingException('Unsupported date format %s' % self.dt_format) except AttributeError as ae: raise MarshallingException(ae)