This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年06月08日 03:52 by halfjuice, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (5) | |||
|---|---|---|---|
| msg190792 - (view) | Author: halfjuice (halfjuice) | Date: 2013年06月08日 03:52 | |
Even with OrderedDict, the plistlib will still output the dict in its own order. Search for sorted(d.items()) in plistlib.py and you will know why. It is certainly warm-hearted to sort this before putting it into plist file but I think sometimes we just want a customized order. |
|||
| msg190815 - (view) | Author: Mher Movsisyan (mher) | Date: 2013年06月08日 18:28 | |
I think this is not a bug. plistlib api accepts dict (not OrderedDict) and sorted output is a valid output. plistlib sorts dictionaries to be consistent with Apple's tools. property list format [1] uses CFDictionary [2] with CFString keys. CFDictionary is unordered and the plist example in the format [1] is unordered too. But plutil [3] command sorts dictionaries. It is easy to observe by self-converting plist files with "plutil -convert xml1 test.plist" command. 1. https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man5/plist.5.html 2. http://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFDictionaryRef/Reference/reference.html 3. https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/plutil.1.html |
|||
| msg190845 - (view) | Author: halfjuice (halfjuice) | Date: 2013年06月09日 06:03 | |
Thanks for giving out docs and start a detail discussion on this Mher! Sorry I'm not familiar with Apple plist tool (I'm using cocos2d-x on win32 for the moment...) Are you saying that plutil is used everytime we output a valid plist? Another thing is whether the example in [1] is valid or not? If it is, I think we should provide unordered functionality. The OrderedDict is subclass of dict and thus is acceptable as plistlib input. Actually when I remove the line for sort, the plist output as expected (with not order). |
|||
| msg190888 - (view) | Author: Ronald Oussoren (ronaldoussoren) * (Python committer) | Date: 2013年06月10日 06:22 | |
I'm reworking the patch in #14455 and one of the things I intend to do is to add a keyword argument that controls whether or not the keys in dictionaries will be sorted by plistlib. |
|||
| msg190942 - (view) | Author: halfjuice (halfjuice) | Date: 2013年06月11日 02:41 | |
Awesome. Thanks Ronald! |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:46 | admin | set | github: 62368 |
| 2014年07月23日 16:07:37 | serhiy.storchaka | set | status: open -> closed resolution: out of date stage: resolved |
| 2013年06月11日 02:41:16 | halfjuice | set | messages: + msg190942 |
| 2013年06月10日 06:22:33 | ronaldoussoren | set | messages: + msg190888 |
| 2013年06月09日 06:03:13 | halfjuice | set | messages: + msg190845 |
| 2013年06月08日 19:01:13 | serhiy.storchaka | set | nosy:
+ ronaldoussoren, ned.deily, hynek |
| 2013年06月08日 18:28:28 | mher | set | nosy:
+ mher messages: + msg190815 |
| 2013年06月08日 03:52:16 | halfjuice | create | |