[Zope-Checkins] CVS: Zope/lib/python/App - PersistentExtra.py:1.8.82.1 class_init.py:1.14.82.1

Jim Fulton cvs-admin at zope.org
Sat Nov 15 07:12:05 EST 2003


Update of /cvs-repository/Zope/lib/python/App
In directory cvs.zope.org:/tmp/cvs-serv24381/lib/python/App

Modified Files:
      Tag: zodb33-devel-branch
	PersistentExtra.py class_init.py 
Log Message:
Changed class modification code to use setattr rather than class
dictionary manipulation, since new-style class dictionaries are
immutable


=== Zope/lib/python/App/PersistentExtra.py 1.8 => 1.8.82.1 ===
--- Zope/lib/python/App/PersistentExtra.py:1.8	Wed Aug 14 17:31:40 2002
+++ Zope/lib/python/App/PersistentExtra.py	Sat Nov 15 07:11:33 2003
@@ -16,7 +16,7 @@
 import Globals
 from DateTime import DateTime
 
-Persistent.__dict__['__class_init__']=default__class_init__
+Persistent.__class_init__ = default__class_init__
 
 class PersistentUtil:
 
@@ -69,4 +69,7 @@
         except: return 0
         return 1
 
-for k, v in PersistentUtil.__dict__.items(): Persistent.__dict__[k]=v
+for k, v in PersistentUtil.__dict__.items():
+    if k[0] != '_':
+        setattr(Persistent, k, v)
+


=== Zope/lib/python/App/class_init.py 1.14 => 1.14.82.1 ===
--- Zope/lib/python/App/class_init.py:1.14	Wed Aug 14 17:31:41 2002
+++ Zope/lib/python/App/class_init.py	Sat Nov 15 07:11:33 2003
@@ -46,11 +46,13 @@
                 d['__name__']=name
             if name=='manage' or name[:7]=='manage_':
                 name=name+'__roles__'
-                if not have(name): dict[name]=('Manager',)
+                if not have(name):
+                    setattr(self, name, ('Manager',))
         elif name=='manage' or name[:7]=='manage_' and type(v) is ft:
             name=name+'__roles__'
-            if not have(name): dict[name]='Manager',
-
+            if not have(name):
+                setattr(self, name, ('Manager',))
+                
     # Look for a SecurityInfo object on the class. If found, call its
     # apply() method to generate __ac_permissions__ for the class. We
     # delete the SecurityInfo from the class dict after it has been
@@ -59,7 +61,7 @@
         if hasattr(value, '__security_info__'):
             security_info=value
             security_info.apply(self)
-            del dict[key]
+            delattr(self, key)
             break
 
     if self.__dict__.has_key('__ac_permissions__'):
@@ -72,4 +74,4 @@
             else:
                 pr=PermissionRole(pname)
             for mname in mnames:
-                dict[mname+'__roles__']=pr
+                setattr(self, mname+'__roles__', pr)




More information about the Zope-Checkins mailing list