[Fedora-suds-list] Timezone-aware Datetime objects

Daniel Rodriguez danjrod at gmail.com
Tue Mar 30 13:50:08 UTC 2010


Hi Jeff,

Thanks for your answer. I think you followed perfectly by reading your
answer. I talk only about received objects. So far I didn't send any.

The issue (as I see it) is that the returned datetime is a "naive" object,
and we live in a world with timezones, daylight saving schemes. And Python
does not mix naive and timezone-aware objects.

The options you suggest:

a) Returning UTC objects. If there were a generic tz object describing this
timezone this would be the best approach. Since coordination of time has to
be referenced to UTC and the object could later be used with
"astimezone(xxx)" to return objects adapted to the timezone to be displayed
to users

b) Option in suds to apply a tz object for returned objects. This can be
possibly seen as an extension of a), since a general UTC tz object would be
replaced by the tz object supplied by the user. But thinking of applications
where the user can change the timezone, applying "astimezone(xxx)" would be
required again.

In my opinion "a" (given the existence of a generic tz object) is the
optimal.

And talking about a generic UTC tz object, this should be at least
definable, since UTC does not have DST settings (UTC is fixed, it is only
the countries moving away from it or getting closer to it with DST)

Best regards

Daniel

On Tue, Mar 30, 2010 at 15:00, Jeff Ortel <jortel at redhat.com> wrote:

> Hey Daniel,
>
> Not sure I follow.  Suds converts received xs:datetime to a python datetime
> object that has been adjusted to the local timezone.  When sending a
> datetime, it is sent with TZ offset.  Are you suggesting a suds /option/
> that would return the xs:datetime in UTC instead of the local TZ?  Or, an
> options for suds to return a datetime object with tz_info set?
>
> Thanks,
>
> Jeff
>
>
> On 03/29/2010 02:52 AM, Daniel Rodriguez wrote:
>
>> Hi Jeff et al,
>>
>> I was wondering what you and others think about always returning
>> timezone-aware datetime objects. The default timezone would be UTC (GMT).
>>
>> If the user of the library knows that the default timezone for an object
>> is not UTC he can then use "replace" to change the timezone without
>> changing the fields.
>>
>> I personally would see it as positive, since I find terrible to rebuild
>> a datetime object just to make the conversion from naive to
>> timezone-aware.
>>
>> Best regards
>>
>> Daniel
>>
>>
>>
>>
>> _______________________________________________
>> suds mailing list
>> suds at lists.fedoraproject.org
>> https://admin.fedoraproject.org/mailman/listinfo/suds
>>
>
>
> _______________________________________________
> suds mailing list
> suds at lists.fedoraproject.org
> https://admin.fedoraproject.org/mailman/listinfo/suds
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/suds/attachments/20100330/12cee991/attachment.html 


More information about the suds mailing list