cwvreg.py
changeset 5880 a022dcbed0d3
parent 5753 cd20ddaef124
child 5890 141b935a38fc
equal deleted inserted replaced
5879:7d3044271a29 5880:a022dcbed0d3
   200 
   200 
   201 from rql import RQLHelper
   201 from rql import RQLHelper
   202 
   202 
   203 from cubicweb import (ETYPE_NAME_MAP, Binary, UnknownProperty, UnknownEid,
   203 from cubicweb import (ETYPE_NAME_MAP, Binary, UnknownProperty, UnknownEid,
   204                       ObjectNotFound, NoSelectableObject, RegistryNotFound,
   204                       ObjectNotFound, NoSelectableObject, RegistryNotFound,
   205                       CW_EVENT_MANAGER, onevent)
   205                       CW_EVENT_MANAGER)
   206 from cubicweb.utils import dump_class
   206 from cubicweb.utils import dump_class
   207 from cubicweb.vregistry import VRegistry, Registry, class_regid
   207 from cubicweb.vregistry import VRegistry, Registry, class_regid
   208 from cubicweb.rtags import RTAGS
   208 from cubicweb.rtags import RTAGS
   209 
   209 
   210 def clear_rtag_objects():
   210 def clear_rtag_objects():
   475         return [value for key, value in self.items()]
   475         return [value for key, value in self.items()]
   476     def itervalues(self):
   476     def itervalues(self):
   477         return (value for key, value in self.items())
   477         return (value for key, value in self.items())
   478 
   478 
   479     def reset(self):
   479     def reset(self):
       
   480         CW_EVENT_MANAGER.emit('before-registry-reset', self)
   480         super(CubicWebVRegistry, self).reset()
   481         super(CubicWebVRegistry, self).reset()
   481         self._needs_iface = {}
   482         self._needs_iface = {}
   482         self._needs_appobject = {}
   483         self._needs_appobject = {}
   483         # two special registries, propertydefs which care all the property
   484         # two special registries, propertydefs which care all the property
   484         # definitions, and propertyvals which contains values for those
   485         # definitions, and propertyvals which contains values for those
   486         if not self.initialized:
   487         if not self.initialized:
   487             self['propertydefs'] = {}
   488             self['propertydefs'] = {}
   488             self['propertyvalues'] = self.eprop_values = {}
   489             self['propertyvalues'] = self.eprop_values = {}
   489             for key, propdef in self.config.eproperty_definitions():
   490             for key, propdef in self.config.eproperty_definitions():
   490                 self.register_property(key, **propdef)
   491                 self.register_property(key, **propdef)
       
   492         CW_EVENT_MANAGER.emit('after-registry-reset', self)
   491 
   493 
   492     def set_schema(self, schema):
   494     def set_schema(self, schema):
   493         """set instance'schema and load application objects"""
   495         """set instance'schema and load application objects"""
   494         self._set_schema(schema)
   496         self._set_schema(schema)
   495         # now we can load application's web objects
   497         # now we can load application's web objects
   635         super(CubicWebVRegistry, self).initialization_completed()
   637         super(CubicWebVRegistry, self).initialization_completed()
   636         for rtag in RTAGS:
   638         for rtag in RTAGS:
   637             # don't check rtags if we don't want to cleanup_interface_sobjects
   639             # don't check rtags if we don't want to cleanup_interface_sobjects
   638             rtag.init(self.schema, check=self.config.cleanup_interface_sobjects)
   640             rtag.init(self.schema, check=self.config.cleanup_interface_sobjects)
   639 
   641 
   640 
       
   641     # rql parsing utilities ####################################################
   642     # rql parsing utilities ####################################################
   642 
   643 
   643     @property
   644     @property
   644     @cached
   645     @cached
   645     def rqlhelper(self):
   646     def rqlhelper(self):