2to3 -f raise
[sfa.git] / sfa / util / storage.py
index ee2e41b..9033434 100644 (file)
@@ -1,5 +1,6 @@
 import os
 from sfa.util.xml import XML
+
 class SimpleStorage(dict):
     """
     Handles storing and loading python dictionaries. The storage file created
@@ -8,8 +9,8 @@ class SimpleStorage(dict):
     db_filename = None
     type = 'dict'
     
-    def __init__(self, db_filename, db = {}):
-
+    def __init__(self, db_filename, db = None):
+        if db is None: db={}
         dict.__init__(self, db)
         self.db_filename = db_filename
     
@@ -18,8 +19,8 @@ class SimpleStorage(dict):
             db_file = open(self.db_filename, 'r')
             dict.__init__(self, eval(db_file.read()))
         elif os.path.exists(self.db_filename) and not os.path.isfile(self.db_filename):
-            raise IOError'%s exists but is not a file. please remove it and try again' \
-                           % self.db_filename
+            raise IOError('%s exists but is not a file. please remove it and try again' \
+                           % self.db_filename)
         else:
             self.write()
             self.load()
@@ -48,8 +49,8 @@ class XmlStorage(SimpleStorage):
             xml = XML(self.db_filename)
             dict.__init__(self, xml.todict())
         elif os.path.exists(self.db_filename) and not os.path.isfile(self.db_filename):
-            raise IOError'%s exists but is not a file. please remove it and try again' \
-                           % self.db_filename
+            raise IOError('%s exists but is not a file. please remove it and try again' \
+                           % self.db_filename)
         else:
             self.write()
             self.load()