added shell service and fixed service

This commit is contained in:
Johannes Findeisen 2013-06-05 00:09:24 +02:00
commit b03d2893f5
2 changed files with 21 additions and 8 deletions

View file

@ -1,14 +1,13 @@
class Service: class Service:
def __init__(self): def __init__(self, parser):
pass self.parser = parser
def _execute(self): def _execute(self):
self.pre_execute() self.pre_execute()
self.execute() self.execute()
self.parse_result() self.parse_result()
self.handle_result() self.handle_result()
def execute(self): def execute(self):
pass pass
@ -16,7 +15,7 @@ class Service:
pass pass
def parse_result(self): def parse_result(self):
pass self.parser._parse()
def handle_result(self): def handle_result(self):
pass pass

View file

@ -1,4 +1,18 @@
""" """
The shell service. This is for executing services as shell commands and don't use a builtin function. This is useful to The shell service. This is for executing services as shell commands
be free to do what you want. and don't use a builtin function. This is useful to be free to do what you want.
""" """
from service import Service
class ShellService(Service):
def __init__(self, parser, log, **kwargs):
super(Service, self).__init__(parser)
if "command" in kwargs:
self.command = kwargs["command"]
else:
log.w("There is no command")
def execute(self):
self.command.call()