Since we fixed the bugs in plistlib w.r.t. date/time stuff before the release of Python 2.4, is there any particularly good reason to use plistservices instead of the updated plistlib?
Well, there is the fact that you have to go to http://sarwat.net/opensource/ to get it. Is that a good reason? :)
The most useful part is the classes it contains and the programming interface that mimics Cocoa. When I'm using plists I often want to manipulate dates the same way I do in Cocoa/CF (datetime et al can be annoying). plistservices has the following classes with the following methods,
class Data: dataWithContentsOfFile dataWithOpenFile dataWithString writeToFile description - CF style description bytes - raw str
class Date (datetime.datetime):
timeIntervalSince1970 -- and vica versa
timeIntervalSinceReferenceDate -- and vv
dateFromStandard8601String - gives you a datetime from an 8601 string; useful with MySQL and the like.
class EasternTimeZone (datetime.tzinfo): Fixed offset in minutes east of UTC
class TimeInterval (datetime.timedelta):
duration - in seconds, same as NSTimeInterval
durationForTimeDelta, a class method for getting the seconds of any timedelta object.
timeIntervalFromStandard8601TimeString(self, string) from __builtin__.type
| mx.DateTime compatibility method.
|
| Given an iso 8601 time string (HH:MM:SS.FF), returns a timeInterval
| compatible with mx.DateTime.ISO.ParseTimeDelta. This means that
| you can also add a - in front of the value to create a negative
| time delta.
(hey, copy & paste is a good idea)
timeIntervalWithTimeDelta, a TimeInterval from a timedelta.
And then there's two module functions, dataFromPropertyList and propertyListFromData, which do what NSPropertyListSerialization does.
{sarwat khan : http://sarwat.net}
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig