always return adapted object on relation property (as with relation set property)

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3188 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2009-01-29 07:45:51 +00:00
parent dfe6423f77
commit 08b9c81b1c
2 changed files with 4 additions and 2 deletions

View file

@ -411,6 +411,8 @@ class ChildRelationSetProperty(RelationSetProperty):
class ParentRelation(object):
# TODO: provide special method for supplying relevance and order
langInfo = None
def __init__(self, predicateName):
self.predicateName = predicateName
@ -418,7 +420,7 @@ class ParentRelation(object):
if inst is None:
return self
for obj in ParentRelationSet(inst, self.predicateName):
return obj
return adapted(obj, langInfo=self.langInfo)
return None
def __set__(self, inst, value):

View file

@ -80,7 +80,7 @@ class RelationFieldInstance(FieldInstance, BaseRelationFieldInstance):
def marshall(self, value):
if value:
return dict(title=value.title, uid=util.getUidForObject(value))
return dict(title=value.title, uid=util.getUidForObject(value.context))
def display(self, value):
if value: