[Zope3-checkins] CVS: Zope3/src/zope/context - __init__.py:1.25

Steve Alexander steve@cat-box.net
Sat, 14 Jun 2003 08:53:58 -0400


Update of /cvs-repository/Zope3/src/zope/context
In directory cvs.zope.org:/tmp/cvs-serv16056/src/zope/context

Modified Files:
	__init__.py 
Log Message:
Changed test to use new-style classes. I had accidentally left it using
classic classes.
Added set of special names to ignore when making attributes of a class
into ContextDescriptors.


=== Zope3/src/zope/context/__init__.py 1.24 => 1.25 ===
--- Zope3/src/zope/context/__init__.py:1.24	Sat Jun 14 08:32:38 2003
+++ Zope3/src/zope/context/__init__.py	Sat Jun 14 08:53:28 2003
@@ -124,9 +124,11 @@
     def __delete__(self, inst):
         self.descriptor.__delete__(inst)
 
+_special_names = ['__module__', '__dict__', '__weakref__', '__doc__']
+_special_names = dict(zip(_special_names, _special_names))
 def _context_aware_advice(cls):
     for name, obj in cls.__dict__.items():
-        if not isinstance(obj, ContextDescriptor):
+        if not (name in _special_names or isinstance(obj, ContextDescriptor)):
             if getattr(obj, '__set__', None) is not None:
                 d = ContextAwareDataDescriptor(obj)
                 setattr(cls, name, d)