[Checkins] SVN: five.customerize/branches/plone-3.0-branch-with-viewlet-support/src/five/customerize/utils.py funnily it's not possible to `getattr` for some attributes listed by `dir(obj)`, `__provides__` in this case; however, since that is unlikely to hold the template a default value for `getattr` will do...

Andreas Zeidler az at zitc.de
Thu Aug 16 06:29:18 EDT 2007


Log message for revision 78874:
  funnily it's not possible to `getattr` for some attributes listed by `dir(obj)`, `__provides__` in this case;  however, since that is unlikely to hold the template a default value for `getattr` will do...

Changed:
  U   five.customerize/branches/plone-3.0-branch-with-viewlet-support/src/five/customerize/utils.py

-=-
Modified: five.customerize/branches/plone-3.0-branch-with-viewlet-support/src/five/customerize/utils.py
===================================================================
--- five.customerize/branches/plone-3.0-branch-with-viewlet-support/src/five/customerize/utils.py	2007-08-16 10:13:23 UTC (rev 78873)
+++ five.customerize/branches/plone-3.0-branch-with-viewlet-support/src/five/customerize/utils.py	2007-08-16 10:29:18 UTC (rev 78874)
@@ -17,7 +17,7 @@
         item = getattr(viewlet, attr, None)
         if isTemplate(item):
             return attr, item
-    attrs = [ attr for attr in dir(viewlet) if isTemplate(getattr(viewlet, attr)) ]
+    attrs = [ attr for attr in dir(viewlet) if isTemplate(getattr(viewlet, attr, None)) ]
     if len(attrs) == 1:
         return attrs[0], getattr(viewlet, attrs[0])
     else:



More information about the Checkins mailing list