X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fstorage%2Fmodel.py;h=6da032b943a102f2ea38478285dddc1192cf220f;hb=2f476496067b5898c3995d81343a4a503cac8988;hp=30670f4acb7371a822935815d3f2c17ec639dc89;hpb=306ee139a4dcb72463c222cc17afa1d20c9daa3a;p=sfa.git diff --git a/sfa/storage/model.py b/sfa/storage/model.py index 30670f4a..6da032b9 100644 --- a/sfa/storage/model.py +++ b/sfa/storage/model.py @@ -111,6 +111,8 @@ class RegRecord (Base,AlchemyObj): record_id = Column (Integer, primary_key=True) # this is the discriminator that tells which class to use classtype = Column (String) + # in a first version type was the discriminator + # but that could not accomodate for 'authority+sa' and the like type = Column (String) hrn = Column (String) gid = Column (String) @@ -136,12 +138,12 @@ class RegRecord (Base,AlchemyObj): if dict: self.load_from_dict (dict) def __repr__(self): - result="[Record id=%s, type=%s, hrn=%s, authority=%s, pointer=%s" % \ + result=""," email=%s"%self.email) + result += ">" return result - + @validates('email') def validate_email(self, key, address): assert '@' in address return address + # xxx this might be temporary def normalize_xml (self): if hasattr(self,'keys'): self.reg_keys = [ RegKey (key) for key in self.keys ] @@ -229,6 +249,7 @@ class RegUser (RegRecord): # xxx tocheck : not sure about eager loading of this one # meaning, when querying the whole records, we expect there should # be a single query to fetch all the keys +# or, is it enough that we issue a single query to retrieve all the keys class RegKey (Base): __tablename__ = 'keys' key_id = Column (Integer, primary_key=True) @@ -241,14 +262,14 @@ class RegKey (Base): if pointer: self.pointer=pointer def __repr__ (self): - result="[key key=%s..."%self.key[8:16] - try: result += " user=%s"%self.user.record_id - except: result += " " - result += "]" + result="