cwvreg.py
branchstable
changeset 5035 8469d0acd949
parent 4996 45ce27d538a1
child 5080 cfc7c2b24f9e
--- a/cwvreg.py	Fri Mar 26 09:19:09 2010 +0100
+++ b/cwvreg.py	Fri Mar 26 13:20:42 2010 +0100
@@ -21,6 +21,9 @@
 from cubicweb.vregistry import VRegistry, Registry, class_regid
 from cubicweb.rtags import RTAGS
 
+def clear_rtag_objects():
+    for rtag in RTAGS:
+        rtag.clear()
 
 def use_interfaces(obj):
     """return interfaces used by the given object by searching for implements
@@ -262,10 +265,7 @@
         if self.config.mode != 'test':
             # don't clear rtags during test, this may cause breakage with
             # manually imported appobject modules
-            @onevent('before-registry-reload')
-            def clear_rtag_objects():
-                for rtag in RTAGS:
-                    rtag.clear()
+            CW_EVENT_MANAGER.bind('before-registry-reload', clear_rtag_objects)
 
     def setdefault(self, regid):
         try: