can run against library 2.0 or 2.1 (sqlalchemy) that has a new interface for dealing...
[sface.git] / sface / sfidata.py
index 9209b1e..1a326c6 100644 (file)
@@ -6,7 +6,6 @@ from PyQt4.QtGui import *
 
 from lxml import etree
 from sfa.util.xrn import hrn_to_urn, urn_to_hrn
-from sfa.storage.record import SfaRecord, SliceRecord, AuthorityRecord, UserRecord
 from sfa.rspecs.rspec import RSpec
 from sface.config import config
 
@@ -32,19 +31,33 @@ class SfiData:
     def getSliceRecord(self):
         rec_file = config.getSliceRecordFile()
         if os.path.exists(rec_file):
-            xml = open(rec_file).read()
-            rec = SliceRecord()
-            rec.load_from_string(xml)
-            return rec
+            try:
+                from sfa.storage.record import SliceRecord
+                xml = open(rec_file).read()
+                rec = SliceRecord()
+                rec.load_from_string(xml)
+                return rec
+            except:
+                from sfa.storage.model import make_record
+                obj=make_record (xml=file(rec_file).read())
+                # consider as a dict for smooth transition
+                return obj.__dict__
         return None
 
     def getUserRecord(self):
         rec_file = config.getUserRecordFile()
         if os.path.exists(rec_file):
-            xml = open(rec_file).read()
-            rec = UserRecord()
-            rec.load_from_string(xml)
-            return rec
+            try:
+                from sfa.storage.record import SliceUser
+                xml = open(rec_file).read()
+                rec = UserRecord()
+                rec.load_from_string(xml)
+                return rec
+            except:
+                from sfa.storage.model import make_record
+                obj=make_record (xml=file(rec_file).read())
+                # consider as a dict for smooth transition
+                return obj.__dict__
         return None
 
     def getUserSliceHrns(self):