def __init__(self, configfile=None): # Initialise the configuration self.load_config(configfile) # Initialise the template enginge. self.templates = rdw_templating.TemplateManager() # Initialise the plugins self.plugins = rdw_plugin.PluginManager(self.cfg) # Initialise the application cwd = os.path.abspath(os.path.dirname(__file__)) config = { b'/': { 'tools.authform.on': True, 'tools.i18n.on': True, 'tools.encode.on': True, 'tools.encode.encoding': 'utf-8', 'tools.gzip.on': True, 'tools.sessions.on': True, }, b'/favicon.ico': { 'tools.authform.on': False, 'tools.staticfile.on': True, 'tools.staticfile.filename': os.path.join(cwd, b'static', b'favicon.ico'), }, b'/login': { 'tools.authform.on': False, }, b'/static': { 'tools.staticdir.on': True, 'tools.staticdir.root': cwd, 'tools.staticdir.dir': "static", 'tools.authform.on': False, }, } self._setup_favicon(config) self._setup_header_logo(config) self._setup_session_storage(config) Application.__init__(self, root=Root(self), config=config) # Activate every loaded plugin self.plugins.run(lambda x: self.activate_plugin(x)) # create user manager self.userdb = UserManager(self)
def __init__(self, configfile=None): # Initialise the configuration self.load_config(configfile) # Initialise the template engine. self.templates = rdw_templating.TemplateManager() # Initialise the plugins self.plugins = rdw_plugin.PluginManager(self.cfg) # Initialise the application config = { native_str('/'): { 'tools.authform.on': True, 'tools.i18n.on': True, 'tools.i18n.default': 'en_US', 'tools.i18n.mo_dir': self._localedirs(), 'tools.i18n.domain': 'messages', 'tools.encode.on': True, 'tools.encode.encoding': 'utf-8', 'tools.gzip.on': True, 'tools.sessions.on': True, 'error_page.default': self.error_page, 'request.error_response': self.error_response, }, } # To work around the new behaviour in CherryPy >= 5.5.0, force usage of # ISO-8859-1 encoding for URL. This avoid any conversion of the # URL into UTF-8. if PY3 and LooseVersion(cherrypy.__version__) >= LooseVersion("5.5.0"): config[native_str('/')]["request.uri_encoding"] = "ISO-8859-1" self._setup_session_storage(config) Application.__init__(self, root=Root(self), config=config) # Activate every loaded plugin self.plugins.run(lambda x: self.activate_plugin(x)) # create user manager self.userdb = UserManager(self) # Start deamon plugins self._start_deamons()
def __init__(self, configfile=None): # Initialise the configuration self.load_config(configfile) # Initialise the template engine. self.templates = rdw_templating.TemplateManager() # Initialise the plugins self.plugins = rdw_plugin.PluginManager(self.cfg) # Initialise the application config = { native_str('/'): { 'tools.authform.on': True, 'tools.i18n.on': True, 'tools.i18n.default': 'en_US', 'tools.i18n.mo_dir': self._localedirs(), 'tools.i18n.domain': 'messages', 'tools.encode.on': True, 'tools.encode.encoding': 'utf-8', 'tools.gzip.on': True, 'tools.sessions.on': True, 'error_page.default': self.error_page, 'request.error_response': self.error_response, }, } # To work around the new behaviour in CherryPy >= 5.5.0, force usage of # ISO-8859-1 encoding for URL. This avoid any conversion of the # URL into UTF-8. if PY3 and LooseVersion(cherrypy.__version__) >= LooseVersion("5.5.0"): config[native_str('/')]["request.uri_encoding"] = "ISO-8859-1" self._setup_session_storage(config) Application.__init__(self, root=Root(self), config=config) # Activate every loaded plugin self.plugins.run(lambda x: self.activate_plugin(x)) # create user manager self.userdb = UserManager(self) # Start deamon plugins self._start_deamons()
def __init__(self, configFile=None): # Initialise config self.load_config(configFile) # Initialise template engine self.templates = bkw_templating.TemplateMgr() # Initialise plugins self.plugins = bkw_plugins.PluginsMgr(self.cfg) # Initialise application config = { native_str('/'): { 'tools.authform.on': True, 'tools.i18n.on': True, 'tools.encode.on': True, 'tools.encode.encoding': 'utf-8', 'tools.gzip.on': True, 'tools.sessions.on': True, 'error_page.default': self.error_page, } } # To work around the new behaviour in CherryPy >= 5.5.0, force usage of # ISO-8859-1 encoding for URL. This avoid any conversion of the # URL into UTF-8. if PY3 and cherrypy.__version__ >= "5.5.0": config[native_str('/')]["request.uri_encoding"] = "ISO-8859-1" self._setup_session_storage(config) Application.__init__(self, root=BkwebRoot(self), config=config) # Activate loaded plugins self.plugins.run(lambda x: self.activate_plugin(x)) # create user manager self.userdb = UserManager(self) # Start deamon plugin self._start_deamons()
def __init__(self, cfg={}): self.cfg = {k.lower(): v for k, v in cfg.items()} # Initialise the template engine. self.templates = rdw_templating.TemplateManager() # Get some config session_path = self.cfg.get("sessiondir", None) # Initialise the application config = { native_str('/'): { 'tools.authform.on': True, 'tools.i18n.on': True, 'tools.i18n.default': 'en_US', 'tools.i18n.mo_dir': pkg_resources.resource_filename( 'rdiffweb', 'locales'), # @UndefinedVariable 'tools.i18n.domain': 'messages', 'tools.encode.on': True, 'tools.encode.encoding': 'utf-8', 'tools.gzip.on': True, 'tools.sessions.on': True, 'tools.proxy.on': CP_PROXY, 'error_page.default': self.error_page, 'request.error_response': self.error_response, 'tools.sessions.storage_type': 'file' if session_path else 'ram', 'tools.sessions.storage_path': session_path, }, } # To work around the new behaviour in CherryPy >= 5.5.0, force usage of # ISO-8859-1 encoding for URL. This avoid any conversion of the # URL into UTF-8. if PY3 and LooseVersion(cherrypy.__version__) >= LooseVersion("5.5.0"): config[native_str('/')]["request.uri_encoding"] = "ISO-8859-1" # Initialize the application Application.__init__(self, root=Root(), config=config) # Register favicon.ico self.root.favicon_ico = static(self._favicon) # Register header_logo if self._header_logo: self.root.header_logo = static(self._header_logo) # Define TEMP env if self._tempdir: os.environ["TMPDIR"] = self._tempdir # create user manager self.userdb = UserManager(self)
def __init__(self, app, path): Application.__init__(self, app.root, app.script_name, app.config) self.profiler = profiler.ProfileAggregator(path)
def __init__(self, app, path): Application.__init__(self, app.root, app.script_name, app.config) self.profiler = profiler.ProfileAggregator(path)