cwvreg.py
changeset 8696 0bb18407c053
parent 8695 358d8bed9626
child 8701 d94d3a3ba586
equal deleted inserted replaced
8695:358d8bed9626 8696:0bb18407c053
    89 .. sourcecode:: python
    89 .. sourcecode:: python
    90 
    90 
    91    # web/views/basecomponents.py
    91    # web/views/basecomponents.py
    92    def registration_callback(vreg):
    92    def registration_callback(vreg):
    93       # register everything in the module except SeeAlsoComponent
    93       # register everything in the module except SeeAlsoComponent
    94       vreg.register_all(globals().values(), __name__, (SeeAlsoVComponent,))
    94       vreg.register_all(globals().itervalues(), __name__, (SeeAlsoVComponent,))
    95       # conditionally register SeeAlsoVComponent
    95       # conditionally register SeeAlsoVComponent
    96       if 'see_also' in vreg.schema:
    96       if 'see_also' in vreg.schema:
    97           vreg.register(SeeAlsoVComponent)
    97           vreg.register(SeeAlsoVComponent)
    98 
    98 
    99 In this example, we register all application object classes defined in the module
    99 In this example, we register all application object classes defined in the module
   622         """update .schema attribute on registered objects, necessary for some
   622         """update .schema attribute on registered objects, necessary for some
   623         tests
   623         tests
   624         """
   624         """
   625         self.schema = schema
   625         self.schema = schema
   626         for registry, regcontent in self.items():
   626         for registry, regcontent in self.items():
   627             for objects in regcontent.values():
   627             for objects in regcontent.itervalues():
   628                 for obj in objects:
   628                 for obj in objects:
   629                     obj.schema = schema
   629                     obj.schema = schema
   630 
   630 
   631     @deprecated('[3.9] use .register instead')
   631     @deprecated('[3.9] use .register instead')
   632     def register_if_interface_found(self, obj, ifaces, **kwargs):
   632     def register_if_interface_found(self, obj, ifaces, **kwargs):
   723                     self.debug('unregister %s (no %s object in registry %s)',
   723                     self.debug('unregister %s (no %s object in registry %s)',
   724                                registry.objid(obj), ' or '.join(regids), regname)
   724                                registry.objid(obj), ' or '.join(regids), regname)
   725                     self.unregister(obj)
   725                     self.unregister(obj)
   726         super(CWRegistryStore, self).initialization_completed()
   726         super(CWRegistryStore, self).initialization_completed()
   727         if 'uicfg' in self: # 'uicfg' is not loaded in a pure repository mode
   727         if 'uicfg' in self: # 'uicfg' is not loaded in a pure repository mode
   728             for rtags in self['uicfg'].values():
   728             for rtags in self['uicfg'].itervalues():
   729                 for rtag in rtags:
   729                 for rtag in rtags:
   730                     # don't check rtags if we don't want to cleanup_interface_sobjects
   730                     # don't check rtags if we don't want to cleanup_interface_sobjects
   731                     rtag.init(self.schema, check=self.config.cleanup_interface_sobjects)
   731                     rtag.init(self.schema, check=self.config.cleanup_interface_sobjects)
   732 
   732 
   733     # rql parsing utilities ####################################################
   733     # rql parsing utilities ####################################################