[Checkins] SVN: Products.GenericSetup/branches/localutility-with-nested-path/Products/GenericSetup/components.py enable support for nested local utilities

Jean-Francois Roche jfroche at jfroche.be
Wed May 25 10:45:37 EDT 2011


Log message for revision 121805:
  enable support for nested local utilities

Changed:
  U   Products.GenericSetup/branches/localutility-with-nested-path/Products/GenericSetup/components.py

-=-
Modified: Products.GenericSetup/branches/localutility-with-nested-path/Products/GenericSetup/components.py
===================================================================
--- Products.GenericSetup/branches/localutility-with-nested-path/Products/GenericSetup/components.py	2011-05-25 14:36:06 UTC (rev 121804)
+++ Products.GenericSetup/branches/localutility-with-nested-path/Products/GenericSetup/components.py	2011-05-25 14:45:36 UTC (rev 121805)
@@ -310,10 +310,11 @@
                 if obj_path in ('', '/'):
                     obj = site
                 else:
-                    # BBB: filter out path segments, we did claim to support
-                    # nested paths once
-                    id_ = [p for p in obj_path.split('/') if p][0]
-                    obj = getattr(site, id_, None)
+                    obj = site
+                    for path in obj_path.split('/'):
+                        if not path:
+                            continue
+                        obj = getattr(obj, path, None)
 
                 if obj is not None:
                     self.context.registerUtility(aq_base(obj), provided, name)



More information about the checkins mailing list