[Zope3-checkins] CVS: Zope3/lib/python/Zope/ContextWrapper - SimpleMethodWrapper.py:1.8

Itamar Shtull-Trauring zope@itamarst.org
Tue, 3 Dec 2002 11:21:13 -0500


Update of /cvs-repository/Zope3/lib/python/Zope/ContextWrapper
In directory cvs.zope.org:/tmp/cvs-serv20163

Modified Files:
	SimpleMethodWrapper.py 
Log Message:
(hopefully) temporary hack to allow __getitem__ as a ContextMethod


=== Zope3/lib/python/Zope/ContextWrapper/SimpleMethodWrapper.py 1.7 => 1.8 ===
--- Zope3/lib/python/Zope/ContextWrapper/SimpleMethodWrapper.py:1.7	Sat Nov 30 13:42:02 2002
+++ Zope3/lib/python/Zope/ContextWrapper/SimpleMethodWrapper.py	Tue Dec  3 11:21:13 2002
@@ -81,7 +81,12 @@
             
         return Wrapper.__getattribute__(self, name)
 
-
+    # this is a hack - __getattribute_ doesn't wrap special __ methods,
+    # and this one needs to be wrapped for PrincipalAnnotationService.
+    # some more general solution ought to be found at some point.
+    def __getitem__(self, key):
+        attr = Wrapper.__getattribute__(self, '__getitem__')
+        return attr.__get__(self)(key)
 
     def __setattr__(self, name, value):
         """Support for ContextProperty.__set__"""