pylint inspired cleanups.

git-svn-id: http://munki.googlecode.com/svn/trunk@632 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-07-30 22:07:15 +00:00
parent a2e227d18f
commit b36f12b36c
+6 -2
View File
@@ -48,6 +48,9 @@ from Foundation import NSData, \
class NSPropertyListSerializationException(Exception):
pass
class NSPropertyListWriteException(Exception):
pass
def readPlist(filepath):
"""
@@ -56,7 +59,7 @@ def readPlist(filepath):
"""
plistData = NSData.dataWithContentsOfFile_(filepath)
dataObject, plistFormat, error = \
NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_errorDescription_(
NSPropertyListSerialization.propertyListFromData_mutabilityOption_format_errorDescription_(
plistData, NSPropertyListMutableContainers, None, None)
if error:
errmsg = "%s in file %s" % (error, filepath)
@@ -90,7 +93,8 @@ def writePlist(dataObject, filepath):
if plistData.writeToFile_atomically_(filepath, True):
return
else:
raise Exception("Failed to write plist data to %s" % filepath)
raise NSPropertyListWriteException(
"Failed to write plist data to %s" % filepath)
def writePlistToString(rootObject):