[issue9256] plistlib should create non-naïve datetime objects
report at bugs.python.org
Wed Jul 14 03:34:04 CEST 2010
New submission from Wim <wiml at hhhh.org>:
The plistlib module parses <date> elements in the plist into datetime objects. (This is good.) However, it produces naïve datetimes, even though the <date> elements include an explicit timezone specification ('Z' for UTC, since they're in ISO 8601 format).
Now that issue 5094 has been fixed, this should be a pretty trivial thing to fix— just pass tzinfo=UTC when creating the datetime (since the regex it uses won't even accept a date that doesn't have the 'Z' suffix, this will be correct).
As an aside: RFC 3339 section 4.3 suggests a convention for distinguishing between "timestamps in UTC" and "timestamps which happen to be defined in terms of UTC, but don't really live in any particular timezone". The python datetime module is not currently able to make this distinction AFAIK, but even though the plist date strings don't follow the RFC 3339 convention, they are most accurately described as having an unknown local offset (like POSIX timestamps, they are UTC-referenced but cannot carry local-timezone info).
title: plistlib should create non-naïve datetime objects
versions: Python 2.5, Python 2.6
Added file: http://bugs.python.org/file17993/plistdt.py
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list