def main():
    '''
    Deprecated. Replaced by the generic module
    main.py
    which gets the ID from url and executes the adapter
    after reading from the xml configuration files
    '''
    config=Configuration()

    view = View(config.system.actions)
    action=config.system.actions[ID]

    adapter=GenericAdapter(ID, view, action.command_group)
    adapter.page()
Example #2
0
def main():
    '''
    gets the ID from the url as key/value=page/action_id
    and through the adapter displays the result of
    the action with ID=action_id. This functionality composed
    with the GenericAdapter help in the portability and API design
    as importing new functions depends now solely on the xml 
    '''
    fs=cgi.FieldStorage()
    ID=fs["page"].value
    try:
        action=config.system.actions[ID]
    except KeyError as ke:
        view.setContent('Page not found', 'The requested page was not found. Did you type the url manually?')
        view.output()
        return
    adapter=GenericAdapter(ID, view, action.command_groups)
    adapter.page()
Example #3
0
def main():
    '''
    gets the ID from the url as key/value=page/action_id
    and through the adapter displays the result of
    the action with ID=action_id. This functionality composed
    with the GenericAdapter help in the portability and API design
    as importing new functions depends now solely on the xml 
    '''
    fs = cgi.FieldStorage()
    try:
        ID = fs["page"].value
        action = config.system.cmdactions[ID]
    except KeyError as ke:
        view.setContent(
            'Page not found',
            'The requested page was not found. Did you type the url manually?')
        output(view, fs)
        return
    adapter = GenericAdapter(ID, action['command-group'])
    title, html = adapter.page()
    view.setContent(title, html)
    output(view, fs)
Example #4
0
 def __init__(self, title, view, commandgroup):
     GenericAdapter.__init__(self, title, view, commandgroup)
     Android.__init__(self)
Example #5
0
def main():
    config=Configuration()
    view = View(config.system.actions)
    commands={'Host Name':'uname -n','Kernel' : 'uname -sr'}
    adapter=GenericAdapter('System Information', view, commands)
    adapter.output()