X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfidata.py;h=1a326c686876a0ec5c48472551ec759d58bbb5be;hp=9209b1e3cc47494354bb9142658129d2c02e736f;hb=c359089db117441b09eba6b6a05313f17bc1ac61;hpb=77e243a9b79137aadeaaf60acc7e1da03a75f8ab diff --git a/sface/sfidata.py b/sface/sfidata.py index 9209b1e..1a326c6 100644 --- a/sface/sfidata.py +++ b/sface/sfidata.py @@ -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):