예제 #1
0
 def find_task_handler(self, task):
     callback = task.get('callback')
     if callback:
         return callback
     else:
         try:
             handler = getattr(self, 'task_%s' % task.name)
         except AttributeError:
             raise NoTaskHandler('No handler or callback defined for task %s' % task.name)
         else:
             return handler
예제 #2
0
파일: base.py 프로젝트: julia-bikova/grab
 def find_task_handler(self, task):
     if task.origin_task_generator is not None:
         return self.handler_for_inline_task
     callback = task.get('callback')
     if callback:
         return callback
     else:
         try:
             handler = getattr(self, 'task_%s' % task.name)
         except AttributeError:
             raise NoTaskHandler('No handler or callback defined for '
                                 'task %s' % task.name)
         else:
             return handler