]> git.phdru.name Git - m_lib.git/blobdiff - m_lib/flad/fladc.py
Fix Flad_Conf: it's itself a dict
[m_lib.git] / m_lib / flad / fladc.py
index 3f5c3541f17c758f0f3958546c905e89acd804f7..6f0347832161edcbea867e703a1d6c6105f7ee11 100644 (file)
@@ -3,10 +3,13 @@
 """
 
 
-import flad, fladm
+from m_lib.flad import flad, fladm
 
 
-error = "fladc.error" # Too many records
+from .flad import checking_error
+class error(checking_error):
+    # Too many records
+    pass
 
 
 class Flad_Conf(dict):
@@ -34,25 +37,25 @@ class Flad_Conf(dict):
       db = self.__make_db()
       db.load_file(f)
 
-      if len(db) <> 1:
-         raise error, "incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db))
+      if len(db) != 1:
+         raise error("incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db)))
 
-      self.data = db[0]
+      self.update(db[0])
 
 
    def load_from_file(self, f):
       db = self.__make_db()
       db.load_from_file(f)
 
-      if len(db) <> 1:
-         raise error, "incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db))
+      if len(db) != 1:
+         raise error("incorrect number of records in config file `%s'; expected 1, got %d" % (str(f), len(db)))
 
-      self.data = db[0]
+      self.update(db[0])
 
 
    def store_to_file(self, f):
       db = self.__make_db()
-      db.append(self.data)
+      db.append(self)
       db.store_to_file(f)