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

Ronald Oussoren report at bugs.python.org
Fri May 24 18:17:57 CEST 2013


Ronald Oussoren added the comment:

I've started work on integrating the latest patch.

Some notes (primarily for my own use):

* I'll drop support for the JSON format, that format is not used
  by Apple's libraries (although the plutil tool can convert plists
  to JSON)

* The patch (plistlib_with_tests.diff) no longer applies cleanly,
  there are two rejected hunks in test_plist.py. 

* There is no documentation update in the patch, I'm working on that

* There is also an NextStep format (see <http://code.google.com/p/networkpx/wiki/PlistSpec>. 
  That format is not supported by plutil, but is supported by 
  Apple's libraries. Support for this can be added later.

* plistlib needs futher work as well, it would be nice to move closer
  to the PEP8 coding style (although this should be done carefully to
  maintain compatibility with existing code.

* plistlib.Data should be deprecated. The class was needed in python 2.7,
  but python 3 already has a unambiguous representation for binary data:
  the bytes type.

* It might be nice to add some options from the json library to 
  the serialization function:

  * skipkeys=True/False: skip keys that aren't strings and cannot
    be represented in a plist file, instead of raising TypeError
  * check_circular=True/False: explicitly check for circular recursion
    and raise an exception instead of hoping that some other
    exception occurs
  * default=function(obj): a function that is called on values that
    cannot be represented, should either return a value that can
    be encoded or raise TypeError
  
* Issue #11101 mentions that it would be nice to have an option
  to ignore keys whose value is None. I'm not sure if this is really
  useful, and if it is it might be better to add a "skip values" option
  that ignores items where the value cannot be encoded.

----------

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


More information about the Python-bugs-list mailing list