Ejemplo n.º 1
0
 def __call__(self, cmd):
     if cmd.strip():
         try:
             ret = self.master.commands.call(cmd)
         except exceptions.CommandError as v:
             signals.status_message.send(message=str(v))
         else:
             if ret:
                 if type(ret) == typing.Sequence[flow.Flow]:
                     signals.status_message.send(
                         message="Command returned %s flows" % len(ret))
                 else:
                     self.master.overlay(overlay.DataViewerOverlay(
                         self.master,
                         ret,
                     ),
                                         valign="top")
Ejemplo n.º 2
0
 def __call__(self, cmd):
     if cmd.strip():
         try:
             ret = self.master.commands.execute(cmd)
         except exceptions.CommandError as e:
             ctx.log.error(str(e))
         else:
             if ret is not None:
                 if type(ret) == typing.Sequence[flow.Flow]:
                     signals.status_message.send(
                         message="Command returned %s flows" % len(ret))
                 elif type(ret) == flow.Flow:
                     signals.status_message.send(
                         message="Command returned 1 flow")
                 else:
                     self.master.overlay(overlay.DataViewerOverlay(
                         self.master,
                         ret,
                     ),
                                         valign="top")