Ejemplo n.º 1
0
 def build_phase_handlers(self):
     """(Re)build phase_handlers in this plugin"""
     for phase, method_name in phase_methods.iteritems():
         if phase in self.phase_handlers:
             continue
         if hasattr(self.instance, method_name):
             method = getattr(self.instance, method_name)
             if not callable(method):
                 continue
             # check for priority decorator
             if hasattr(method, 'priority'):
                 handler_prio = method.priority
             else:
                 handler_prio = DEFAULT_PRIORITY
             event = add_phase_handler('plugin.%s.%s' % (self.name, phase), method, handler_prio)
             # provides backwards compatibility
             event.plugin = self
             self.phase_handlers[phase] = event
Ejemplo n.º 2
0
 def build_phase_handlers(self):
     """(Re)build phase_handlers in this plugin"""
     for phase, method_name in phase_methods.iteritems():
         if phase in self.phase_handlers:
             continue
         if hasattr(self.instance, method_name):
             method = getattr(self.instance, method_name)
             if not callable(method):
                 continue
             # check for priority decorator
             if hasattr(method, 'priority'):
                 handler_prio = method.priority
             else:
                 handler_prio = DEFAULT_PRIORITY
             event = add_phase_handler('plugin.%s.%s' % (self.name, phase), method, handler_prio)
             # provides backwards compatibility
             event.plugin = self
             self.phase_handlers[phase] = event