[Zope3-checkins] CVS: Zope3/src/zope/app/utilities - wrapper.py:1.2

Sidnei da Silva cvs-admin at zope.org
Mon Nov 24 12:38:09 EST 2003


Update of /cvs-repository/Zope3/src/zope/app/utilities
In directory cvs.zope.org:/tmp/cvs-serv15984/src/zope/app/utilities

Modified Files:
	wrapper.py 
Log Message:
Fix descriptor handling inside the persistent wrapper. Also add a test to confirm that it works


=== Zope3/src/zope/app/utilities/wrapper.py 1.1 => 1.2 ===
--- Zope3/src/zope/app/utilities/wrapper.py:1.1	Sat Oct 18 14:56:24 2003
+++ Zope3/src/zope/app/utilities/wrapper.py	Mon Nov 24 12:37:38 2003
@@ -99,7 +99,12 @@
       # And also handle descriptors for the proxied object,
       # but using the proxied object on __get__ calls.
       if hasattr(v, '__get__'):
-          return v.__get__(proxied, type(proxied))
+          # We should call it only if it came from the class,
+          # otherwise its a descriptor being used as an instance
+          # attribute, so just return it.
+          if (hasattr(proxied, '__class__') and
+              getattr(proxied.__class__, name) is v):
+              return v.__get__(proxied, type(proxied))
       return v
 
   def __setattr__(self, name, v):




More information about the Zope3-Checkins mailing list