示例#1
0
 def __init__(self, storage=None):
     if not storage:
         s = config.get("gyro-session-storage",
                 "gyro.builtins.session.InMemorySessionStorage")
         self.storage = util.import_class(s)()
     else:
         self.storage = storage
         
     self.session_timeout = datetime.timedelta(hours=config.get(
         "gyro-session-timeout", 24))
示例#2
0
 def __init__(self):
     self.smart_reload = config.get("gyro-smart-reload", True)
     self.poll_interval = config.get("gyro-reload-poll-interval", 3)
     self.had_first_request = False
     self.watch_files = []
     self.module_mtimes = {}
     self.location = os.path.dirname(__file__)
     
     if config.development and not self.smart_reload:
         self.start_monitoring()
示例#3
0
 def __init__(self, storage=None):
     if not storage:
         s = config.get("gyro-auth-token-storage",
                        "gyro.builtins.auth.InMemoryAuthTokenStorage")
         self.storage = util.import_class(s)()
     else:
         self.storage = storage
         
     self.token_valid_time = datetime.timedelta(days=config.get(
         "gyro-auth-token-timeout", 90))
示例#4
0
def start(**kwargs):
    """
    Start our HTTP server
    """
    s = config.get('server', 'gyro.impl.twisted.server.HttpServer')
    port = kwargs.get("port", None)
    if not port:
        port = config.get("port", 9999)

    server = util.import_class(s)
    print 'Starting server %s on port %s' % (server, port)
    core.server = server()
    core.server.run(port)

    if not config.development and config.get("gyro-smart-reload", True):
        plugin.load_second_plugins()
示例#5
0
 def __call__(self, cls):
     if not self.provider:
         p = config.get("gyro-auth-provider", "gyro.auth.AuthProvider")
         provider = util.import_class(p)
         
         cls.auth_provider = provider
     else:
         cls.auth_provider = self.provider
         
     return cls
示例#6
0
def run(path, daemonize=False, development=False, **kwargs):
    if not path:
        path = os.getcwd()

    config.load(os.path.join(path, 'app.conf'))

    config.app_path = path
    config.app_name = path.rsplit("/", 1)[1]
    config.development = development
    config.daemonize = daemonize

    sys.path.append(config.app_path)

    core.load(config.get("core", "gyro.impl.twisted.core.TwistedCore"))

    plugin.load_start_plugins()

    core.call_when_running(start, **kwargs)
    core.run()
示例#7
0
def get_builtin_plugin_file():
    return os.path.join(config.app_path, config.get('plugin_file', 'builtin_plugins.conf'))