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

Steve Alexander steve@cat-box.net
Tue, 12 Nov 2002 10:55:59 -0500


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

Modified Files:
	SimpleMethodWrapper.py 
Log Message:
updated the tests.

made setting a ContextProperty when you have that name in an instance
dict work.


=== Zope3/lib/python/Zope/ContextWrapper/SimpleMethodWrapper.py 1.5 => 1.6 ===
--- Zope3/lib/python/Zope/ContextWrapper/SimpleMethodWrapper.py:1.5	Tue Nov 12 05:57:33 2002
+++ Zope3/lib/python/Zope/ContextWrapper/SimpleMethodWrapper.py	Tue Nov 12 10:55:58 2002
@@ -88,14 +88,13 @@
                     getbaseobject=getbaseobject):
         """Support for ContextProperty.__set__"""
         obj = getbaseobject(self)
-        if name not in (getattr(obj, '__dict__', empty_dict) or 
-                        getattr(obj, '__slots__', empty_dict)):
-            attr = getattr(obj.__class__, name, None)
-            if attr is not None:
-                attrdict = getattr(attr, '__dict__', empty_dict)
-                if attrdict.get('Zope.ContextWrapper.contextful_set'):
-                    attr.__set__(self, value)
-                    return
+        class_ = obj.__class__
+        class_value = getattr(class_, name, None)
+        if hasattr(class_value, '__get__'):
+            attrdict = getattr(class_value, '__dict__', empty_dict)
+            if attrdict.get('Zope.ContextWrapper.contextful_set'):
+                class_value.__set__(self, value)
+                return
         setattr(obj, name, value)