コード例 #1
0
ファイル: Utility.py プロジェクト: HackLinux/chandler
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()
コード例 #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()
コード例 #3
0
ファイル: Utility.py プロジェクト: HackLinux/chandler
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
コード例 #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