X-Git-Url: http://git.onelab.eu/?p=sface.git;a=blobdiff_plain;f=sface%2Fsfidata.py;h=fb98ac5541d5ac0094775802bfeb82d8cf6d5d7a;hp=315fddca5b6e52085e32d3ccc2bf7cd77004f7cf;hb=37dfde8c6c59f3c33d1225d3c73cb5ec11c12306;hpb=c6329bf47bb381a75a23c34c02071e6f7571ba7b diff --git a/sface/sfidata.py b/sface/sfidata.py index 315fddc..fb98ac5 100644 --- a/sface/sfidata.py +++ b/sface/sfidata.py @@ -3,7 +3,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from lxml import etree -from sfa.util.record import SfaRecord, SliceRecord, AuthorityRecord +from sfa.util.record import SfaRecord, SliceRecord, AuthorityRecord, UserRecord from sfa.rspecs.rspec_parser import parse_rspec from sface.config import config @@ -35,6 +35,22 @@ class SfiData: return rec 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 + return None + + def getUserSliceHrns(self): + rec = self.getUserRecord() + if rec: + return rec.get_field("slices") + + return [] + def purgeNonSliceResources(self, rspec): # This can probably go away once the new slice manager is fully # deployed.