ClientScript register

This commit is contained in:
Ruud
2011-04-11 15:37:41 +02:00
parent 2a60a4eaa3
commit 0672e120a0
19 changed files with 514 additions and 15 deletions
+20
View File
@@ -1,7 +1,27 @@
from couchpotato.api import addApiView
from couchpotato.environment import Env
from flask.helpers import send_from_directory
import os.path
class Plugin():
def conf(self, attr):
return Env.setting(attr, self.__class__.__name__.lower())
def registerStatic(self, file_path):
class_name = self.__class__.__name__.lower()
self.plugin_file = file_path
path = class_name + '.static/'
addApiView(path + '<path:file>', self.showStatic, static = True)
return path
def showStatic(self, file = ''):
plugin_dir = os.path.dirname(self.plugin_file)
dir = os.path.join(plugin_dir, 'static')
return send_from_directory(dir, file)