[Zope-Checkins] CVS: Zope/lib/python/App - ProductContext.py:1.43.16.1

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


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

Modified Files:
      Tag: zodb33-devel-branch
	ProductContext.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/ProductContext.py 1.43 => 1.43.16.1 ===
--- Zope/lib/python/App/ProductContext.py:1.43	Fri May  2 18:01:34 2003
+++ Zope/lib/python/App/ProductContext.py	Sat Nov 15 07:23:08 2003
@@ -166,8 +166,10 @@
 
             fd = pack.__FactoryDispatcher__ = __FactoryDispatcher__
 
-        if not hasattr(pack, '_m'): pack._m=fd.__dict__
-        m=pack._m
+        if not hasattr(pack, '_m'):
+            pack._m = AttrDict(fd)
+
+        m = pack._m
 
         if interfaces is _marker:
             if instance_class is None:
@@ -341,3 +343,11 @@
                     continue
                 ht=APIHelpTopic.APIHelpTopic(file, '', os.path.join(path, file))
                 self.registerHelpTopic(file, ht)
+
+class AttrDict:
+
+    def __init__(self, ob):
+        self.ob = ob
+
+    def __setitem__(self, name, v):
+        setattr(self.ob, name, v)




More information about the Zope-Checkins mailing list