cwvreg.py
changeset 2657 de974465d381
parent 2655 48cd71bdb5cd
child 2658 5535857eeaa5
equal deleted inserted replaced
2656:a93ae0f6c0ad 2657:de974465d381
    32         try:
    32         try:
    33             impl = obj.__select__.search_selector(implements)
    33             impl = obj.__select__.search_selector(implements)
    34             if impl:
    34             if impl:
    35                 return sorted(impl.expected_ifaces)
    35                 return sorted(impl.expected_ifaces)
    36         except AttributeError:
    36         except AttributeError:
    37             pass # old-style vobject classes with no accepts_interfaces
    37             pass # old-style appobject classes with no accepts_interfaces
    38         except:
    38         except:
    39             print 'bad selector %s on %s' % (obj.__select__, obj)
    39             print 'bad selector %s on %s' % (obj.__select__, obj)
    40             raise
    40             raise
    41         return ()
    41         return ()
    42 
    42 
   306             self.debug('available in registry %s: %s', regname, sorted(reg))
   306             self.debug('available in registry %s: %s', regname, sorted(reg))
   307             reg.initialization_completed()
   307             reg.initialization_completed()
   308         # we may want to keep interface dependent objects (e.g.for i18n
   308         # we may want to keep interface dependent objects (e.g.for i18n
   309         # catalog generation)
   309         # catalog generation)
   310         if self.config.cleanup_interface_sobjects:
   310         if self.config.cleanup_interface_sobjects:
   311             # remove vobjects that don't support any available interface
   311             # remove appobjects that don't support any available interface
   312             implemented_interfaces = set()
   312             implemented_interfaces = set()
   313             if 'Any' in self.get('etypes', ()):
   313             if 'Any' in self.get('etypes', ()):
   314                 for etype in self.schema.entities():
   314                 for etype in self.schema.entities():
   315                     cls = self['etypes'].etype_class(etype)
   315                     cls = self['etypes'].etype_class(etype)
   316                     for iface in cls.__implements__:
   316                     for iface in cls.__implements__:
   321                                    and iface in self.schema
   321                                    and iface in self.schema
   322                                    and self['etypes'].etype_class(iface)
   322                                    and self['etypes'].etype_class(iface)
   323                                    or iface
   323                                    or iface
   324                                    for iface in ifaces)
   324                                    for iface in ifaces)
   325                 if not ('Any' in ifaces or ifaces & implemented_interfaces):
   325                 if not ('Any' in ifaces or ifaces & implemented_interfaces):
   326                     self.debug('kicking vobject %s (no implemented '
   326                     self.debug('kicking appobject %s (no implemented '
   327                                'interface among %s)', obj, ifaces)
   327                                'interface among %s)', obj, ifaces)
   328                     self.unregister(obj)
   328                     self.unregister(obj)
   329         # clear needs_iface so we don't try to remove some not-anymore-in
   329         # clear needs_iface so we don't try to remove some not-anymore-in
   330         # objects on automatic reloading
   330         # objects on automatic reloading
   331         self._needs_iface.clear()
   331         self._needs_iface.clear()