--- a/server/repository.py Thu Oct 15 20:31:44 2009 +0200
+++ b/server/repository.py Thu Oct 15 20:31:55 2009 +0200
@@ -95,6 +95,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 ?
@@ -110,6 +111,7 @@
return
ensure_card_respected(session.unsafe_execute, session, eidfrom, rtype, eidto)
+
def ensure_card_respected(execute, session, eidfrom, rtype, eidto):
card = rproperty(session, rtype, eidfrom, eidto, 'cardinality')
# one may be tented to check for neweids but this may cause more than one
@@ -127,6 +129,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