Ejemplo n.º 1
0
    def process_dl(self, req, start_response):
        params = req['PATH_INFO'].split('/', 3)
        self.log.debug('Dispatching download: %s'%req['PATH_INFO'])

        path = PluginLoader.get_plugin_path(self.app, params[2])
        file = os.path.join(path, params[2], 'files', params[3])

        return wsgi_serve_file(req, start_response, file)
Ejemplo n.º 2
0
    def refresh_plugin_data(self):
        """
        Rescans plugins for JS, CSS, LESS, XSLT widgets and XML templates.
        """
        self.template_path = []
        self.less_styles = []
        self.template_styles = []
        self.template_scripts = []
        self.layouts = {}
        includes = []
        functions = {}

        for f in self.grab_plugins(IXSLTFunctionProvider):
            functions.update(f.get_funcs())

        # Get path for static content and templates
        plugins = []
        plugins.extend(PluginLoader.list_plugins().keys())
        plugins.extend(netcontrol.plugins.plist)

        for c in plugins:
            path = os.path.join(PluginLoader.get_plugin_path(self, c), c)

            fp = os.path.join(path, 'files')
            if os.path.exists(fp):
                self.template_styles.extend([
                    '/dl/' + c + '/' + s for s in os.listdir(fp)
                    if s.endswith('.css')
                ])
                self.less_styles.extend([
                    '/dl/' + c + '/' + s for s in os.listdir(fp)
                    if s.endswith('.less')
                ])
                self.template_scripts.extend([
                    '/dl/' + c + '/' + s for s in os.listdir(fp)
                    if s.endswith('.js')
                ])

            wp = os.path.join(path, 'widgets')
            if os.path.exists(wp):
                includes.extend([
                    os.path.join(wp, s) for s in os.listdir(wp)
                    if s.endswith('.xslt')
                ])

            lp = os.path.join(path, 'layout')
            if os.path.exists(lp):
                for s in os.listdir(lp):
                    if s.endswith('.xml'):
                        self.layouts['%s:%s' % (c, s)] = os.path.join(lp, s)

            tp = os.path.join(path, 'templates')
            if os.path.exists(tp):
                self.template_path.append(tp)

        if xslt.xslt is None:
            xslt.prepare(includes, functions)
Ejemplo n.º 3
0
    def refresh_plugin_data(self):
        """
        Rescans plugins for JS, CSS, LESS, XSLT widgets and XML templates.
        """
        self.template_path = []
        self.less_styles = []
        self.template_styles = []
        self.template_scripts = []
        self.layouts = {}
        includes = []
        functions = {}

        for f in self.grab_plugins(IXSLTFunctionProvider):
            functions.update(f.get_funcs())

        # Get path for static content and templates
        plugins = []
        plugins.extend(PluginLoader.list_plugins().keys())
        plugins.extend(netcontrol.plugins.plist)

        for c in plugins:
            path = os.path.join(PluginLoader.get_plugin_path(self, c), c)

            fp = os.path.join(path, 'files')
            if os.path.exists(fp):
                self.template_styles.extend([
                    '/dl/'+c+'/'+s
                    for s in os.listdir(fp)
                    if s.endswith('.css')
                ])
                self.less_styles.extend([
                    '/dl/'+c+'/'+s
                    for s in os.listdir(fp)
                    if s.endswith('.less')
                ])
                self.template_scripts.extend([
                    '/dl/'+c+'/'+s
                    for s in os.listdir(fp)
                    if s.endswith('.js')
                ])

            wp = os.path.join(path, 'widgets')
            if os.path.exists(wp):
                includes.extend([
                    os.path.join(wp, s)
                    for s in os.listdir(wp)
                    if s.endswith('.xslt')
                ])

            lp = os.path.join(path, 'layout')
            if os.path.exists(lp):
                for s in os.listdir(lp):
                    if s.endswith('.xml'):
                        self.layouts['%s:%s'%(c,s)] = os.path.join(lp, s)

            tp = os.path.join(path, 'templates')
            if os.path.exists(tp):
                self.template_path.append(tp)

        if xslt.xslt is None:
            xslt.prepare(
                includes,
                functions
            )