server/repository.py
changeset 3720 5376aaadd16b
parent 3647 2941f4a0aab9
parent 3694 33dbb1da1db9
child 3722 c414f402cbff
--- a/server/repository.py	Thu Oct 15 11:20:26 2009 +0200
+++ b/server/repository.py	Mon Oct 19 15:16:41 2009 +0200
@@ -90,6 +90,7 @@
     def commit_event(self):
         pass
 
+
 def del_existing_rel_if_needed(session, eidfrom, rtype, eidto):
     """delete existing relation when adding a new one if card is 1 or ?
 
@@ -105,6 +106,7 @@
         return
     ensure_card_respected(session.unsafe_execute, session, eidfrom, rtype, eidto)
 
+
 def ensure_card_respected(execute, session, eidfrom, rtype, eidto):
     card = session.schema_rproperty(rtype, eidfrom, eidto, 'cardinality')
     # one may be tented to check for neweids but this may cause more than one
@@ -122,6 +124,7 @@
         execute('DELETE X %s Y WHERE NOT X eid %%(x)s, Y eid %%(y)s' % rtype,
                 {'x': eidfrom, 'y': eidto}, 'y')
 
+
 class Repository(object):
     """a repository provides access to a set of persistent storages for
     entities and relations
@@ -984,8 +987,8 @@
         # XXX use entity.keys here since edited_attributes is not updated for
         # inline relations
         for attr in entity.keys():
-            rschema = eschema.subject_relation(attr)
-            if not rschema.is_final(): # inlined relation
+            rschema = eschema.subjrels[attr]
+            if not rschema.final: # inlined relation
                 relations.append((attr, entity[attr]))
         entity.set_defaults()
         entity.check(creation=True)
@@ -1003,7 +1006,7 @@
             rtype = str(rschema)
             if rtype in schema.VIRTUAL_RTYPES:
                 continue
-            if rschema.is_final():
+            if rschema.final:
                 entity.setdefault(rtype, None)
             else:
                 entity.set_related_cache(rtype, 'subject', session.empty_rset())
@@ -1043,8 +1046,8 @@
         for attr in edited_attributes:
             if attr == 'eid':
                 continue
-            rschema = eschema.subject_relation(attr)
-            if rschema.is_final():
+            rschema = eschema.subjrels[attr]
+            if rschema.final:
                 if eschema.rproperty(attr, 'fulltextindexed'):
                     need_fti_update = True
                 only_inline_rels = False