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

Fred L. Drake, Jr. fred at zope.com
Fri Jan 16 16:27:45 EST 2004


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

Modified Files:
      Tag: zope3-zodb3-devel-branch
	wrapper.py 
Log Message:
- change import to use ZODB 3.3
- use constant to check object's persistence state
- fix call to base __getattribute__


=== Zope3/src/zope/app/utilities/wrapper.py 1.2 => 1.2.4.1 ===
--- Zope3/src/zope/app/utilities/wrapper.py:1.2	Mon Nov 24 12:37:38 2003
+++ Zope3/src/zope/app/utilities/wrapper.py	Fri Jan 16 16:27:44 2004
@@ -14,7 +14,7 @@
 """Provide persistent wrappers for objects that cannot derive from
 persistence for some reason."""
 
-from persistence import Persistent
+from persistent import Persistent, GHOST
 from zope.interface import implementedBy
 from zope.security.checker import selectChecker
 
@@ -37,7 +37,7 @@
             #
             # Added the same code below, in ClassDescriptor,
             # though I'm not sure it is really needed there.
-            if inst._p_state == 3:
+            if inst._p_state == GHOST:
                 inst._p_activate()
             return selectChecker(inst.__proxied__)
 
@@ -51,7 +51,7 @@
         if inst is None:
             return cls
         else:
-            if inst._p_state == 3:
+            if inst._p_state == GHOST:
                 inst._p_activate()
             return inst.__proxied__.__class__
 
@@ -85,14 +85,14 @@
 
   def __getattribute__(self, name):
       if name.startswith('_p_') or name in struct_attrs:
-          v = object.__getattribute__(self, name)
+          v = Persistent.__getattribute__(self, name)
           # Handle descriptors here, eg: __Security_checker__
           # is a descriptor for Struct objects.
           if hasattr(v, '__get__'):
               return v.__get__(self, type(self))
           return v
       # XXX This is butt ugly. See the comment on SecurityDescriptor.
-      if self._p_state == 3:
+      if self._p_state == GHOST:
           self._p_activate()
       proxied = self.__proxied__
       v = getattr(proxied, name)




More information about the Zope3-Checkins mailing list