Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Avoid deleting class attributes on reload. This preserves things adde…

…d by ZCML/grokkers/InitializeClass adn so on
  • Loading branch information...
commit 8e9f538886be8ab05d542f78e98417b36fbff344 1 parent 2044235
@optilude optilude authored
Showing with 18 additions and 7 deletions.
  1. +8 −2 CHANGES.txt
  2. +9 −4 plone/reload/xreload.py
  3. +1 −1  setup.py
View
10 CHANGES.txt
@@ -1,8 +1,14 @@
Changelog
=========
-1.0
----
+0.10 (2009-03-22)
+-----------------
+
+- Do not remove attributes from classes when reloading. ZCML directives and
+ other wiring is liable to add attributes to class that will then disappear
+ on reload. This means that if you have removed a class attribute, it will
+ *not* disappear on reload. In this case: restart. :)
+ [optilude]
0.9 (2008-07-23)
View
13 plone/reload/xreload.py
@@ -18,8 +18,6 @@
import types
import inspect
-import ExtensionClass
-
import zope.component
class Reloader(object):
@@ -161,8 +159,15 @@ def _update_class(oldclass, newclass):
newnames = set(newdict)
for name in newnames - oldnames:
setattr(oldclass, name, newdict[name])
- for name in oldnames - newnames:
- delattr(oldclass, name)
+
+ # Note: We do not delete attributes, because various ZCML directives,
+ # grokkers and other wiring add class attributes during startup that
+ # would get lost if we did this. Note that attributes will still be
+ # overwritten if they've changed.
+ #
+ # for name in oldnames - newnames:
+ # delattr(oldclass, name)
+
for name in oldnames & newnames - set(["__dict__", "__doc__"]):
new = getattr(newclass, name)
old = getattr(oldclass, name, None)
View
2  setup.py
@@ -3,7 +3,7 @@
from setuptools import setup, find_packages
name = 'plone.reload'
-version = '1.0'
+version = '0.10'
def read(*rnames):
return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
Please sign in to comment.
Something went wrong with that request. Please try again.