[issue14455] plistlib unable to read json and binary plist files

d9pouces report at bugs.python.org
Sun Apr 8 10:31:27 CEST 2012


d9pouces <python at 19pouces.net> added the comment:

Here is the new patch, allowing read and write binary, json and xml plist files.

It includes both the plistlib.py and test/test_plistlib.py patches.
JSON format does not allow dates and data, so XML is used by default to write files.
I use the json library to write JSON plist files, but its output is slightly different from the Apple default output: keys of dictionaries are in different order. Thus, I removed the test_appleformattingfromliteral test for JSON files.

Similarly, my binary writer does not write the same binary files as the Apple library: my library writes the content of compound objects (dicts, lists and sets) before the object itself, while Apple writes the object before its content. Copying the Apple behavior results in some additional weird lines of code, for little benefit. Thus, I also removed the  test_appleformattingfromliteral test for binary files.

Other tests are made for all the three formats.

----------
Added file: http://bugs.python.org/file25156/plistlib_with_test.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue14455>
_______________________________________


More information about the Python-bugs-list mailing list