def __init__(self, started=False): super(sessionManagerController, self).__init__() log.debug("Setting up the session manager.") self.started = started manager.setup() self.view = view.sessionManagerWindow() widgetUtils.connect_event(self.view.new, widgetUtils.BUTTON_PRESSED, self.manage_new_account) widgetUtils.connect_event(self.view.remove, widgetUtils.BUTTON_PRESSED, self.remove) if self.started == False: widgetUtils.connect_event(self.view.configuration, widgetUtils.BUTTON_PRESSED, self.configuration) else: self.view.hide_configuration() self.new_sessions = {} self.removed_sessions = []
def main(): """ durain [-c configfile] [-h] options: * -c: config file * -h: show help """ optlist, args = getopt.getopt(sys.argv[1:], "c:f:l:h") optdict = dict(optlist) if "-h" in optdict: print main.__doc__ return cfg = utils.getcfg(optdict.get("-c", ["durian.conf", "~/.durian.conf", "/etc/durian/durian.conf"])) utils.initlog(cfg.get("log", "loglevel"), cfg.get("log", "logfile")) import http if cfg.has_section("pool"): http.connector.max_addr = cfg.getint("pool", "maxaddr") addr = (cfg.get("main", "addr"), cfg.getint("main", "port")) import proxy, manager p = proxy.Proxy(accesslog=cfg.get("log", "access")) p.application = manager.setup(p) if cfg.getboolean("log", "verbose"): p.VERBOSE = True import midware if cfg.has_section("auth"): auth = midware.Auth() if cfg.has_option("auth", "userfile"): auth.loadfile(cfg.get("auth", "userfile")) elif cfg.has_option("auth", "username"): auth.add(cfg.get("auth", "username"), cfg.get("auth", "password")) auth.setup(p) if cfg.has_section("cache"): store = None if cfg.get("cache", "engine") == "memory": store = midware.MemoryCache(cfg.getint("cache", "size")) if store: midware.Cache(store).setup(p) try: StreamServer(addr, p.handler).serve_forever() except KeyboardInterrupt: pass