[vreg] new [before|after]-registry-reset event, taking vreg as argument
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 05 Jul 2010 13:34:29 +0200
changeset 5880 a022dcbed0d3
parent 5879 7d3044271a29
child 5881 57387070f612
[vreg] new [before|after]-registry-reset event, taking vreg as argument
cwvreg.py
--- a/cwvreg.py	Mon Jul 05 12:37:21 2010 +0200
+++ b/cwvreg.py	Mon Jul 05 13:34:29 2010 +0200
@@ -202,7 +202,7 @@
 
 from cubicweb import (ETYPE_NAME_MAP, Binary, UnknownProperty, UnknownEid,
                       ObjectNotFound, NoSelectableObject, RegistryNotFound,
-                      CW_EVENT_MANAGER, onevent)
+                      CW_EVENT_MANAGER)
 from cubicweb.utils import dump_class
 from cubicweb.vregistry import VRegistry, Registry, class_regid
 from cubicweb.rtags import RTAGS
@@ -477,6 +477,7 @@
         return (value for key, value in self.items())
 
     def reset(self):
+        CW_EVENT_MANAGER.emit('before-registry-reset', self)
         super(CubicWebVRegistry, self).reset()
         self._needs_iface = {}
         self._needs_appobject = {}
@@ -488,6 +489,7 @@
             self['propertyvalues'] = self.eprop_values = {}
             for key, propdef in self.config.eproperty_definitions():
                 self.register_property(key, **propdef)
+        CW_EVENT_MANAGER.emit('after-registry-reset', self)
 
     def set_schema(self, schema):
         """set instance'schema and load application objects"""
@@ -637,7 +639,6 @@
             # don't check rtags if we don't want to cleanup_interface_sobjects
             rtag.init(self.schema, check=self.config.cleanup_interface_sobjects)
 
-
     # rql parsing utilities ####################################################
 
     @property