From dd66347498d0b83e65444b0ae15c1ca33d34ba5c Mon Sep 17 00:00:00 2001 From: helmutm Date: Sat, 8 Mar 2008 10:15:17 +0000 Subject: [PATCH] added linkUrl attribute to note for controlling appearance of link text git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2440 fd906abe-77d9-0310-91a1-e0d9ade77398 --- README.txt | 15 ++++++++++++++- browser/resource_macros.pt | 4 +++- common.py | 6 ++++++ concept.py | 1 + interfaces.py | 13 +++++++++---- organize/schema.py | 6 ++++-- 6 files changed, 37 insertions(+), 8 deletions(-) diff --git a/README.txt b/README.txt index ed5f501..2f7de08 100755 --- a/README.txt +++ b/README.txt @@ -762,10 +762,11 @@ The new technique uses the ``fields`` and ``data`` attributes... data textarea False None contentType dropdown True <...SimpleVocabulary object...> linkUrl textline False None + linkText textline False None >>> view.data {'linkUrl': u'http://', 'contentType': 'text/restructured', 'data': u'', - 'title': u'Test Note'} + 'linkText': u'', 'title': u'Test Note'} The object is changed via a FormController adapter created for a NodeView. @@ -834,6 +835,18 @@ informations about all parents of an object. Type 2 +Caching +======= + +To be done... + + >>> from loops.common import cached + >>> obj = resources['test_note'] + >>> cxObj = cached(obj) + >>> [p.object.title for p in cxObj.getAllParents()] + [u'Note', u'Type'] + + Import/Export ============= diff --git a/browser/resource_macros.pt b/browser/resource_macros.pt index 096280a..f9fc6b8 100644 --- a/browser/resource_macros.pt +++ b/browser/resource_macros.pt @@ -30,7 +30,9 @@ more... + tal:attributes="href linkUrl" + tal:define="linkText item/adapted/linkText|nothing" + tal:content="python: linkText or 'more...'">more... diff --git a/common.py b/common.py index 374be95..7c98663 100644 --- a/common.py +++ b/common.py @@ -209,3 +209,9 @@ class NameChooser(BaseNameChooser): specialCharacters = { '\xc4': 'Ae', '\xe4': 'ae', '\xd6': 'Oe', '\xf6': 'oe', '\xdc': 'Ue', '\xfc': 'ue', '\xdf': 'ss'} + +# caching + +def cached(obj): + return obj + diff --git a/concept.py b/concept.py index 96d3351..5970dd9 100644 --- a/concept.py +++ b/concept.py @@ -285,6 +285,7 @@ class Concept(Contained, Persistent): if canListObject(r.second)) return sorted(rels, key=sort) + # concept manager class ConceptManager(BTreeContainer): diff --git a/interfaces.py b/interfaces.py index f419c02..14ba8fd 100644 --- a/interfaces.py +++ b/interfaces.py @@ -694,10 +694,15 @@ class INote(ITextDocument): """ linkUrl = schema.TextLine( - title=_(u'Link URL'), - description=_(u'An (optional) link associated with this note'), - default=u'http://', - required=False) + title=_(u'Link URL'), + description=_(u'An (optional) link associated with this note'), + default=u'http://', + required=False) + linkText = schema.TextLine( + title=_(u'Link text'), + description=_(u'Text for "more..." link.'), + required=False,) + # events diff --git a/organize/schema.py b/organize/schema.py index 6258d7b..a0a63cc 100644 --- a/organize/schema.py +++ b/organize/schema.py @@ -37,8 +37,10 @@ class PersonSchemaFactory(SchemaFactory): def __call__(self, interface, **kw): schema = super(PersonSchemaFactory, self).__call__(interface, **kw) - schema.fields.phoneNumbers.instance_name ='simplelist' - schema.fields.birthDate.display_format = ('date', 'long') + if 'phoneNumbers' in schema.fields.keys(): + schema.fields.phoneNumbers.instance_name ='simplelist' + if 'birthDate' in schema.fields.keys(): + schema.fields.birthDate.display_format = ('date', 'long') return schema