[Zope3-checkins] CVS: Zope3/src/zope/app/publisher/browser - resources.py:1.3

Jim Fulton jim@zope.com
Sat, 25 Jan 2003 08:19:59 -0500


Update of /cvs-repository/Zope3/src/zope/app/publisher/browser
In directory cvs.zope.org:/tmp/cvs-serv20617

Modified Files:
	resources.py 
Log Message:
Added a __getitem__ method to the resources view (aka @@) so that it
can be used in zpt paths as will as in URLs. 


=== Zope3/src/zope/app/publisher/browser/resources.py 1.2 => 1.3 ===
--- Zope3/src/zope/app/publisher/browser/resources.py:1.2	Wed Dec 25 09:13:09 2002
+++ Zope3/src/zope/app/publisher/browser/resources.py	Sat Jan 25 08:19:25 2003
@@ -37,7 +37,7 @@
         resource = resource_service.queryResource(wrapped_self, name, request)
         if resource is None:
             raise NotFoundError(wrapped_self, name)
-        return ContextWrapper(resource, resource_service)
+        return ContextWrapper(resource, resource_service, name=name)
 
     publishTraverse = ContextMethod(publishTraverse)
 
@@ -45,8 +45,10 @@
         '''See interface IBrowserPublisher'''
         return empty, ()
 
-    #
-    ############################################################
+    def __getitem__(self, name):
+        return self.publishTraverse(self.request, name)
+
+    __getitem__ = ContextMethod(__getitem__)
 
 def empty():
     return ''