Commit e538888b authored by Sylvain's avatar Sylvain
Browse files

fix a bug on deletion of symetric relation definition

parent cc0a82fceb40
......@@ -7,6 +7,7 @@ ChangeLog for yams
* use dbhelper to generate index sql
* don't use ordered_relation when it's not necessary
* removed deprecated code
* fix a bug on deletion of symetric relation definition
2007-10-29 -- 0.14.0
* schema building refactoring to read schema from a bunch of directories
......
......@@ -607,6 +607,9 @@ class RelationSchema(ERSchema):
pass
try:
del self._rproperties[(subjschema, objschema)]
except KeyError:
pass
try:
if self.symetric and subjschema != objschema:
del self._rproperties[(objschema, subjschema)]
except KeyError:
......@@ -655,7 +658,12 @@ class RelationSchema(ERSchema):
def iter_rdefs(self):
"""return an iterator on (subject, object) of this relation"""
return self._rproperties.iterkeys()
rproperty_keys = deprecated_function(iter_rdefs)
rproperty_keys = deprecated_function(iter_rdefs) # XXX bw compat
def rdefs(self):
"""return a list of (subject, object) of this relation"""
return self._rproperties.keys()
def has_rdef(self, subj, obj):
return (subj, obj) in self._rproperties
......@@ -876,6 +884,8 @@ class Schema(object):
subjschema.del_subject_relation(rtype)
if not rschema.symetric:
objschema.del_object_relation(rtype)
else:
objschema.del_subject_relation(rtype)
if rschema.del_relation_def(subjschema, objschema):
del self._relations[rtype]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment