Exemplo n.º 1
0
def initTwisted(view, options=None):
    from osaf.startup import run_reactor

    # options.webserver can be:
    # - None (don't start webserver)
    # - a port number string (happens when env var is set but is overridden)
    # - empty list (start with default port)
    # - list of port number strings (start using the first one in list)
    if options and options.webserver:
        if isinstance(options.webserver, list):
            port = int(options.webserver[0])
        else:
            port = int(options.webserver)
        schema.ns('osaf.app', view).mainServer.port = port
        # Commit so twisted thread can see the change
        view.commit()

    run_reactor()
Exemplo n.º 2
0
def initTwisted(view, options=None):
    from osaf.startup import run_reactor

    # options.webserver can be:
    # - None (don't start webserver)
    # - a port number string (happens when env var is set but is overridden)
    # - empty list (start with default port)
    # - list of port number strings (start using the first one in list)
    if options and options.webserver:
        if isinstance(options.webserver, list):
            port = int(options.webserver[0])
        else:
            port = int(options.webserver)
        schema.ns('osaf.app', view).mainServer.port = port
        # Commit so twisted thread can see the change
        view.commit()

    run_reactor()
Exemplo n.º 3
0
def initOnlineStatus(view, options):
    if options.offline: # offline specified on command line; persist value
        schema.ns('osaf.app', view).prefs.isOnline = False
    else: # not specified on command line; inherit persisted value
        options.offline = not schema.ns('osaf.app', view).prefs.isOnline
Exemplo n.º 4
0
def initOnlineStatus(view, options):
    if options.offline:  # offline specified on command line; persist value
        schema.ns('osaf.app', view).prefs.isOnline = False
    else:  # not specified on command line; inherit persisted value
        options.offline = not schema.ns('osaf.app', view).prefs.isOnline