[Zope-Checkins] SVN: Products.Five/branches/regebro-localutility-fix/site/utility.py The old tests would have done the wrong thing if we had utilities named "foo" and

Lennart Regebro regebro at gmail.com
Sun Feb 26 15:35:08 EST 2006


Log message for revision 65498:
  The old tests would have done the wrong thing if we had utilities named "foo" and 
  "superfoo".
  

Changed:
  U   Products.Five/branches/regebro-localutility-fix/site/utility.py

-=-
Modified: Products.Five/branches/regebro-localutility-fix/site/utility.py
===================================================================
--- Products.Five/branches/regebro-localutility-fix/site/utility.py	2006-02-26 20:31:28 UTC (rev 65497)
+++ Products.Five/branches/regebro-localutility-fix/site/utility.py	2006-02-26 20:35:07 UTC (rev 65498)
@@ -53,8 +53,12 @@
         """
         if getattr(aq_base(self.context), 'utilities', None) is not None:
             for id, utility in self.context.utilities.objectItems():
-                if (interface.providedBy(utility) and
-                    (name == '' or id.endswith(name))):
+                if interface.providedBy(utility):
+                    if id.find('-') != -1:
+                        prefix, utility_name = id.split('-', 1)
+                    else:
+                        utility_name = ''
+                    if name == utility_name:
                         return utility
         return self.next.queryUtility(interface, name, default)
 



More information about the Zope-Checkins mailing list