X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fstorage.py;h=793a38ebbd474bbed5e1c37b03c23fd516339987;hb=02a4a59a4a49183ec8c631cc03243b97f4602d50;hp=5d915398efc6df679733afd8181f811853b63f35;hpb=4d2b508926a415a1f347d07349a43138a4c79c1a;p=sfa.git diff --git a/sfa/util/storage.py b/sfa/util/storage.py index 5d915398..793a38eb 100644 --- a/sfa/util/storage.py +++ b/sfa/util/storage.py @@ -1,6 +1,5 @@ import os - -from sfa.util.rspec import RecordSpec +from sfa.util.xml import XML class SimpleStorage(dict): """ @@ -46,10 +45,9 @@ class XmlStorage(SimpleStorage): """ Parse an xml file and store it as a dict """ - data = RecordSpec() if os.path.exists(self.db_filename) and os.path.isfile(self.db_filename): - data.parseFile(self.db_filename) - dict.__init__(self, data.toDict()) + 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 @@ -58,8 +56,8 @@ class XmlStorage(SimpleStorage): self.load() def write(self): - data = RecordSpec() - data.parseDict(self) + xml = XML() + xml.parseDict(self) db_file = open(self.db_filename, 'w') db_file.write(data.toprettyxml()) db_file.close()