Skip to content

Commit

Permalink
Adapt IPhotoPlistParser to Python 3.4
Browse files Browse the repository at this point in the history
This also means that Python 3.3 isn't supported anymore for that part.
Updated README accordingly.
  • Loading branch information
Virgil Dupras committed May 3, 2014
1 parent ebd7f1b commit f5f29d7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Prerequisites are installed through `pip`. However, some of them are not "pip in
to be installed manually.

* All systems: [Python 3.3+][python] and [setuptools][setuptools]
* Mac OS X: The last XCode to have the 10.7 SDK included.
* Mac OS X: The last XCode to have the 10.7 SDK included. Python 3.4+.
* Windows: Visual Studio 2010, [PyQt 5.0+][pyqt], [cx_Freeze][cxfreeze] and
[Advanced Installer][advinst] (you only need the last two if you want to create an installer)

Expand Down
12 changes: 6 additions & 6 deletions core_pe/iphoto_plist.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@

import plistlib

class IPhotoPlistParser(plistlib.PlistParser):
class IPhotoPlistParser(plistlib._PlistParser):
"""A parser for iPhoto plists.
iPhoto plists tend to be malformed, so we have to subclass the built-in parser to be a bit more
lenient.
"""
def __init__(self):
plistlib.PlistParser.__init__(self)
plistlib._PlistParser.__init__(self, use_builtin_types=True, dict_type=dict)
# For debugging purposes, we remember the last bit of data to be analyzed so that we can
# log it in case of an exception
self.lastdata = ''

def getData(self):
self.lastdata = plistlib.PlistParser.getData(self)
def get_data(self):
self.lastdata = plistlib._PlistParser.get_data(self)
return self.lastdata

def end_integer(self):
try:
self.addObject(int(self.getData()))
self.add_object(int(self.get_data()))
except ValueError:
self.addObject(0)
self.add_object(0)

0 comments on commit f5f29d7

Please sign in to comment.