Commit abcfd65d authored by "Sylvain ext:(%22)'s avatar "Sylvain ext:(%22)
Browse files

fix schema reading to correctly handle raw RelationDefinition classes

parent 0627ea8e3f37
......@@ -5,6 +5,7 @@ ChangeLog for yams
* new RestrictedEntityType base class and new maxsize, vocabulary and unique
parameters on relation definition to ease schema construction
* schema2dot nicely refactored but schema_view'll probably deprecated soon
* fix schema reading to correctly handle raw RelationDefinition classes
2006-09-22 -- 0.7.0
* fix a major bug in entity validation
......
......@@ -251,10 +251,19 @@ class RelationType(RelationBase):
class RelationDefinition(RelationBase):
subject = None
object = None
def __init__(self, subject, name, object, **kwargs):
self.subject = subject
self.object = object
self.name = name
def __init__(self, subject=None, name=None, object=None, **kwargs):
if subject:
self.subject = subject
else:
self.subject = self.__class__.subject
if object:
self.object = object
else:
self.object = self.__class__.object
if name:
self.name = name
elif not getattr(self, 'name', None):
self.name = self.__class__.__name__
super(RelationDefinition, self).__init__(**kwargs)
def register_relations(self, schema):
......
......@@ -8,7 +8,6 @@ relation definitions files or a direct python definition file)
:contact: http://www.logilab.fr/ -- mailto:contact@logilab.fr
"""
__revision__ = "$Id: reader.py,v 1.16 2006-04-10 14:38:59 syt Exp $"
__docformat__ = "restructuredtext en"
__metaclass__ = type
......
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