[Zope-Checkins] SVN: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/ Fixed some code for registering class changes to avoid the

Jim Fulton jim at zope.com
Mon Feb 7 07:36:07 EST 2005


Log message for revision 29072:
  Fixed some code for registering class changes to avoid the
  registration of data managers that are None.  This code will,
  eventually, go away, since new persistent classes will
  take care of their own registration.
  

Changed:
  U   Zope/branches/jim-fix-zclasses/lib/python/ZClasses/Property.py
  U   Zope/branches/jim-fix-zclasses/lib/python/ZClasses/ZClass.py

-=-
Modified: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/Property.py
===================================================================
--- Zope/branches/jim-fix-zclasses/lib/python/ZClasses/Property.py	2005-02-07 12:36:05 UTC (rev 29071)
+++ Zope/branches/jim-fix-zclasses/lib/python/ZClasses/Property.py	2005-02-07 12:36:07 UTC (rev 29072)
@@ -23,13 +23,13 @@
     def __setattr__(self, name, v):
         klass=self._k
         setattr(klass, name, v)
-        if not getattr(klass,'_p_changed',None):
+        if not getattr(klass,'_p_changed',None) and klass._p_jar is not None:
             get_transaction().register(klass)
             klass._p_changed=1
     def __delattr__(self, name):
         klass=self._k
         delattr(klass, name)
-        if not getattr(klass,'_p_changed',None):
+        if not getattr(klass,'_p_changed',None) and klass._p_jar is not None:
             get_transaction().register(klass)
             klass._p_changed=1
 
@@ -270,7 +270,7 @@
 Globals.default__class_init__(ZInstanceSheet)
 
 def rclass(klass):
-    if not getattr(klass, '_p_changed', 0):
+    if not getattr(klass, '_p_changed', 0) and klass._p_jar is not None:
         get_transaction().register(klass)
         klass._p_changed=1
 

Modified: Zope/branches/jim-fix-zclasses/lib/python/ZClasses/ZClass.py
===================================================================
--- Zope/branches/jim-fix-zclasses/lib/python/ZClasses/ZClass.py	2005-02-07 12:36:05 UTC (rev 29071)
+++ Zope/branches/jim-fix-zclasses/lib/python/ZClasses/ZClass.py	2005-02-07 12:36:07 UTC (rev 29072)
@@ -519,7 +519,7 @@
     def setClassAttr(self, name, value):
         c=self._zclass_
         setattr(c, name, value)
-        if not c._p_changed:
+        if (not c._p_changed) and (c._p_jar is not None):
             get_transaction().register(c)
             c._p_changed=1
 
@@ -527,7 +527,7 @@
     def delClassAttr(self, name):
         c=self._zclass_
         delattr(c, name)
-        if not c._p_changed:
+        if (not c._p_changed) and (c._p_jar is not None):
             get_transaction().register(c)
             c._p_changed=1
 



More information about the Zope-Checkins mailing list