示例#1
0
    def __init__(self, app):
        LocationsPage.__init__(self, app)
        self.browse = BrowsePage(app)
        self.restore = RestorePage(app)
        self.history = HistoryPage(app)
        self.status = StatusPage(app)
        self.admin = AdminPage(app)
        self.prefs = PreferencesPage(app)
        self.settings = SettingsPage(app)
        self.api = ApiPage(app)

        # Register static dir.
        static_dir = pkg_resources.resource_filename(
            'rdiffweb', 'static')  # @UndefinedVariable
        self.static = static(static_dir)

        # Register favicon.ico
        default_favicon = pkg_resources.resource_filename(
            'rdiffweb', 'static/favicon.ico')  # @UndefinedVariable
        favicon = app.cfg.get_config("Favicon", default_favicon)
        self.favicon_ico = static(favicon)

        # Register header_logo
        header_logo = app.cfg.get_config("HeaderLogo")
        if header_logo:
            self.header_logo = static(header_logo)

        # Register robots.txt
        robots_txt = pkg_resources.resource_filename(
            'rdiffweb', 'static/robots.txt')  # @UndefinedVariable
        self.robots_txt = static(robots_txt)
示例#2
0
    def __init__(self, app):
        LocationsPage.__init__(self, app)
        self.browse = BrowsePage(app)
        self.restore = RestorePage(app)
        self.history = HistoryPage(app)
        self.status = StatusPage(app)
        self.admin = AdminPage(app)
        self.prefs = PreferencesPage(app)
        self.settings = SettingsPage(app)
        self.api = ApiPage(app)

        # Register static dir.
        static_dir = pkg_resources.resource_filename('rdiffweb', 'static')  # @UndefinedVariable
        self.static = static(static_dir)

        # Register favicon.ico
        default_favicon = pkg_resources.resource_filename('rdiffweb', 'static/favicon.ico')  # @UndefinedVariable
        favicon = app.cfg.get_config("Favicon", default_favicon)
        self.favicon_ico = static(favicon)

        # Register header_logo
        header_logo = app.cfg.get_config("HeaderLogo")
        if header_logo:
            self.header_logo = static(header_logo)

        # Register robots.txt
        robots_txt = pkg_resources.resource_filename('rdiffweb', 'static/robots.txt')  # @UndefinedVariable
        self.robots_txt = static(robots_txt)
示例#3
0
 def activate(self):
     # Register new handler to show graphs.
     self.app.root.graphs = GraphsPage(self.app)
     # Register function into templates
     self.app.templates.jinja_env.globals['url_for_graphs'] = url_for_graphs
     # Add extra js to static
     path = pkg_resources.resource_filename(__name__, 'd3.v3.js')  # @UndefinedVariable
     self.app.root.static.d3_v3_js = static(path)
     path = pkg_resources.resource_filename(__name__, 'd3.tip.v0.6.3.js')  # @UndefinedVariable
     self.app.root.static.d3_tip_v0_6_3_js = static(path)
     # Call original
     IRdiffwebPlugin.activate(self)
示例#4
0
 def activate(self):
     # Register new handler to show graphs.
     self.app.root.graphs = GraphsPage(self.app)
     # Register function into templates
     self.app.templates.jinja_env.globals['url_for_graphs'] = url_for_graphs
     # Add extra js to static
     path = pkg_resources.resource_filename(
         __name__, 'd3.v3.js')  # @UndefinedVariable
     self.app.root.static.d3_v3_js = static(path)
     path = pkg_resources.resource_filename(
         __name__, 'd3.tip.v0.6.3.js')  # @UndefinedVariable
     self.app.root.static.d3_tip_v0_6_3_js = static(path)
     # Call original
     IRdiffwebPlugin.activate(self)
示例#5
0
    def activate(self):
        logger.info("activate plugin object [%s]", self.__class__.__name__)

        # Add templates location to the templating engine.
        template_dir = self.get_templatesdir()
        if template_dir:
            self.app.templates.add_templatesdir(template_dir)

        # Add static dir if available using the module name.
        static_dir = self.get_staticdir()
        if static_dir:
            name = self.__class__.__module__.split('.')[-1]
            setattr(self.app.root, name + '_static', static(static_dir))