Handle PLIST <date> and <data> elements appropriately #3

Closed
facelessuser opened this Issue Jan 21, 2014 · 3 comments

Comments

Projects
None yet
1 participant
Owner

facelessuser commented Jan 21, 2014

Suggestion from wbond/package_control_channel#2660 (comment)

Handle PLIST and elements conversions appropriately both from plist and to plist. Must provide a way to convert back to and as well.

See:

  • plistlib._dateToString
  • plistlib._dateParser
  • plistlib._dateFromString

For JSON, there is no easy way to identify plist base64 with 100% certainty. So require base64 to have some unique identifier. Like a dict with a single key, value pair where the key denotes binary data, and the value is the binary data.

{
    "python/object:plistlib.Data": "U29tZSBkYXRh"
}
Owner

facelessuser commented Jan 22, 2014

ST3 working on bench. Date converts with no issues between JSON, PLIST, and YAML. Data converts between all three carrying plist data info:

        <data>U29tZSBkYXRh</data>
                {
                    "python/object:plistlib.Data": "U29tZSBkYXRh"
                }
        - !!python/object:plistlib.Data
            data: !!binary |
                U29tZSBkYXRh

ST2 support not implemented yet.

Owner

facelessuser commented Jan 22, 2014

ST2 support now in as well.

Owner

facelessuser commented Jan 22, 2014

New fixes and cleanup have been applied. This should now work 100%.

Now binary data will just be converted directly to and from this form in YAML:

           -  !!binary |
                U29tZSBkYXRh

Json still converts with the python object since there is no standardized way of storing and recognizing binary data in json.

                {
                    "python/object:plistlib.Data": "U29tZSBkYXRh"
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment