def registerStatic(self, plugin_file, add_to_head = True): # Register plugin path self.plugin_path = os.path.dirname(plugin_file) # Get plugin_name from PluginName s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', self.__class__.__name__) class_name = re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() path = 'static/' + class_name + '/' addView(path + '<path:file>', self.showStatic, static = True) if add_to_head: for f in glob.glob(os.path.join(self.plugin_path, 'static', '*')): fireEvent('register_%s' % ('script' if getExt(f) in 'js' else 'style'), path + os.path.basename(f))
def registerStatic(self, plugin_file, add_to_head=True): # Register plugin path self.plugin_path = os.path.dirname(plugin_file) # Get plugin_name from PluginName s1 = re.sub("(.)([A-Z][a-z]+)", r"\1_\2", self.__class__.__name__) class_name = re.sub("([a-z0-9])([A-Z])", r"\1_\2", s1).lower() path = "api/%s/static/%s/" % (Env.setting("api_key"), class_name) addView(path + "<path:filename>", self.showStatic, static=True) if add_to_head: for f in glob.glob(os.path.join(self.plugin_path, "static", "*")): ext = getExt(f) if ext in ["js", "css"]: fireEvent("register_%s" % ("script" if ext in "js" else "style"), path + os.path.basename(f))
def registerStatic(self, plugin_file, add_to_head = True): # Register plugin path self.plugin_path = os.path.dirname(plugin_file) # Get plugin_name from PluginName s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', self.__class__.__name__) class_name = re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() path = 'api/%s/static/%s/' % (Env.setting('api_key'), class_name) addView(path + '<path:filename>', self.showStatic, static = True) if add_to_head: for f in glob.glob(os.path.join(self.plugin_path, 'static', '*')): ext = getExt(f) if ext in ['js', 'css']: fireEvent('register_%s' % ('script' if ext in 'js' else 'style'), path + os.path.basename(f))