diff --git a/expert/browser/search.py b/expert/browser/search.py index 5a08a2f..95f1fb9 100644 --- a/expert/browser/search.py +++ b/expert/browser/search.py @@ -158,7 +158,7 @@ class Search(BaseView): adObj = adapted(o, self.languageInfo) if filterMethod is not None and not filterMethod(adObj): continue - name = self.getRowName(adObj) + name = self.getRowName(adObj) or u'' if title and title.endswith('*'): title = title[:-1] sort = ((title and name.startswith(title) and '0' or '1') diff --git a/schema/base.py b/schema/base.py index 49e98f9..3222319 100644 --- a/schema/base.py +++ b/schema/base.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2009 Helmut Merz helmutm@cy55.de +# Copyright (c) 2011 Helmut Merz helmutm@cy55.de # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,8 +18,6 @@ """ Specialized field definitions. - -$Id$ """ from zope.component import adapts @@ -59,7 +57,8 @@ class Relation(Field): __typeInfo__ = ('relation', FieldType('relation', 'relation', u'A field representing a related object.', - instanceName='relation')) + instanceName='relation', + displayRenderer='display_relation')) def __init__(self, *args, **kw): self.target_types = kw.pop('target_types', ()) diff --git a/schema/field.py b/schema/field.py index 98dd32b..2fd2be2 100644 --- a/schema/field.py +++ b/schema/field.py @@ -93,9 +93,14 @@ class RelationFieldInstance(FieldInstance, BaseRelationFieldInstance): def display(self, value): if value: - return value.title + nodeView = self.clientInstance.view.nodeView + return dict(url=nodeView.getUrlForTarget(baseObject(value)), + label=value.title) return u'' def unmarshall(self, value): return util.getObjectForUid(value) + def getRenderer(self, name): + return relation_macros.macros[name] + diff --git a/schema/relation_macros.pt b/schema/relation_macros.pt index 071a45a..4fce423 100755 --- a/schema/relation_macros.pt +++ b/schema/relation_macros.pt @@ -12,6 +12,12 @@ + + + + +