@@ -18,18 +18,24 @@ The property list (``.plist``) file format is a simple XML pickle supporting
1818basic object types, like dictionaries, lists, numbers and strings. Usually the
1919top level object is a dictionary.
2020
21+ To write out and to parse a plist file, use the :func: `writePlist ` and
22+ :func: `readPlist ` functions.
23+
24+ To work with plist data in bytes objects, use :func: `writePlistToBytes `
25+ and :func: `readPlistFromBytes `.
26+
2127Values can be strings, integers, floats, booleans, tuples, lists, dictionaries
2228(but only with string keys), :class: `Data ` or :class: `datetime.datetime `
2329objects. String values (including dictionary keys) have to be unicode strings --
2430they will be written out as UTF-8.
2531
2632The ``<data> `` plist type is supported through the :class: `Data ` class. This is
27- a thin wrapper around a Python string . Use :class: `Data ` if your strings
33+ a thin wrapper around a Python bytes object . Use :class: `Data ` if your strings
2834contain control characters.
2935
3036.. seealso ::
3137
32- `PList manual page <http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html> `
38+ `PList manual page <http://developer.apple.com/documentation/Darwin/Reference/ManPages/man5/plist.5.html >`_
3339 Apple's documentation of the file format.
3440
3541
@@ -55,26 +61,26 @@ This module defines the following functions:
5561 a container that contains objects of unsupported types.
5662
5763
58- .. function :: readPlistFromString (data)
64+ .. function :: readPlistFromBytes (data)
5965
60- Read a plist from a string . Return the root object.
66+ Read a plist data from a bytes object . Return the root object.
6167
6268
63- .. function :: writePlistToString (rootObject)
69+ .. function :: writePlistToBytes (rootObject)
6470
65- Return *rootObject * as a plist-formatted string .
71+ Return *rootObject * as a plist-formatted bytes object .
6672
6773
6874The following class is available:
6975
7076.. class :: Data(data)
7177
72- Return a "data" wrapper object around the string *data *. This is used in
73- functions converting from/to plists to represent the ``<data> `` type
78+ Return a "data" wrapper object around the bytes object *data *. This is used
79+ in functions converting from/to plists to represent the ``<data> `` type
7480 available in plists.
7581
7682 It has one attribute, :attr: `data `, that can be used to retrieve the Python
77- string stored in it.
83+ bytes object stored in it.
7884
7985
8086Examples
@@ -93,8 +99,8 @@ Generating a plist::
9399 aTrueValue = True,
94100 aFalseValue = False,
95101 ),
96- someData = Data("<binary gunk>"),
97- someMoreData = Data("<lots of binary gunk>" * 10),
102+ someData = Data(b "<binary gunk>"),
103+ someMoreData = Data(b "<lots of binary gunk>" * 10),
98104 aDate = datetime.datetime.fromtimestamp(time.mktime(time.gmtime())),
99105 )
100106 writePlist(pl, fileName)
0 commit comments