On 28 Jun 2005, at 23:39, [EMAIL PROTECTED] wrote:
Author: jmorliaguet
Date: Tue Jun 28 23:39:48 2005
New Revision: 24502
Modified: z3lab/cpsskins/trunk/elements/formats/boxlayout.py
======================================================================
========
--- z3lab/cpsskins/trunk/elements/formats/boxlayout.py (original)
+++ z3lab/cpsskins/trunk/elements/formats/boxlayout.py Tue Jun
28 23:39:48 2005
@@ -89,43 +89,54 @@
else:
self.markup = ''
+################################################################
+
+def renderItems(content, start='', repeat='%s', separator='',
end='', **kw):
+ if IMenuItems.providedBy(content):
+ items_markup = [start]
+ items_append = items_markup.append
+ for item in content:
+ items_append(repeat % (item['url'], item['title']))
+ items_append(separator)
+ items_append(end)
+ return ''.join(items_markup)
+ else:
+ return ''
In general in Zope 3 it's my understanding that it's better to do
try:
c = IMenuItems(content)
except ComponentLookupError:
return ''
... c used as iterable ...
return ...
than testing directly for the provided interface, as it gives an
opportunity for an adapter to do its job. It's probably slower
though, and maybe not a pattern generally used for marker interfaces.
Opinions ?
Florent
--
Florent Guillaume, Nuxeo (Paris, France) CTO, Director of R&D
+33 1 40 33 71 59 http://nuxeo.com [EMAIL PROTECTED]
_______________________________________________
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users