[Zope3-checkins] SVN: Zope3/trunk/src/zope/contentprovider/tales.py add name to provider if it provides ILocation, so it knows about its name

Bernd Dorn bernd.dorn at lovelysystems.com
Sun Jan 28 07:09:45 EST 2007


Log message for revision 72246:
  add name to provider if it provides ILocation, so it knows about its name

Changed:
  U   Zope3/trunk/src/zope/contentprovider/tales.py

-=-
Modified: Zope3/trunk/src/zope/contentprovider/tales.py
===================================================================
--- Zope3/trunk/src/zope/contentprovider/tales.py	2007-01-28 11:57:09 UTC (rev 72245)
+++ Zope3/trunk/src/zope/contentprovider/tales.py	2007-01-28 12:09:45 UTC (rev 72246)
@@ -23,8 +23,8 @@
 from zope.tales import expressions
 
 from zope.contentprovider import interfaces
+from zope.location.interfaces import ILocation
 
-
 def addTALNamespaceData(provider, context):
     """Add the requested TAL attributes to the provider"""
     data = {}
@@ -64,6 +64,10 @@
         if provider is None:
             raise interfaces.ContentProviderLookupError(name)
 
+        # add the __name__ attribute if it implements ILocation
+        if ILocation.providedBy(provider):
+            provider.__name__ = name
+
         # Insert the data gotten from the context
         addTALNamespaceData(provider, econtext)
 



More information about the Zope3-Checkins mailing list