summaryrefslogtreecommitdiffstats
path: root/module/web
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-02-06 12:56:32 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-02-06 12:56:32 +0100
commit2cb61c7c17138c9144a3b66e5c1689c4f8f3560f (patch)
treec59fadd6fdb8431dcd2a131564990fe15408e655 /module/web
parentsome fixes (diff)
downloadpyload-2cb61c7c17138c9144a3b66e5c1689c4f8f3560f.tar.xz
closed #231
Diffstat (limited to 'module/web')
-rw-r--r--module/web/utils.py4
-rw-r--r--module/web/webinterface.py7
2 files changed, 6 insertions, 5 deletions
diff --git a/module/web/utils.py b/module/web/utils.py
index cf3f2d5f3..d7e76f84d 100644
--- a/module/web/utils.py
+++ b/module/web/utils.py
@@ -16,8 +16,6 @@
@author: RaNaN
"""
-from os.path import join, abspath, commonprefix
-
from bottle import request, HTTPError, redirect, ServerAdapter
from webinterface import env, TEMPLATE
@@ -26,7 +24,7 @@ def render_to_response(name, args={}, proc=[]):
for p in proc:
args.update(p())
- t = env.get_template(join(TEMPLATE, name))
+ t = env.get_template(TEMPLATE + "/" + name)
return t.render(**args)
def parse_permissions(session):
diff --git a/module/web/webinterface.py b/module/web/webinterface.py
index ea649c835..dd5920486 100644
--- a/module/web/webinterface.py
+++ b/module/web/webinterface.py
@@ -33,7 +33,7 @@ from module import InitHomeDir
import bottle
from bottle import run, app
-from jinja2 import Environment, FileSystemLoader, FileSystemBytecodeCache
+from jinja2 import Environment, FileSystemLoader, PrefixLoader, FileSystemBytecodeCache
from middlewares import StripPathMiddleware, GZipMiddleWare
try:
@@ -89,7 +89,10 @@ if not exists(join("tmp", "jinja_cache")):
makedirs(join("tmp", "jinja_cache"))
bcc = FileSystemBytecodeCache(join("tmp","jinja_cache"))
-env = Environment(loader=FileSystemLoader(join(PROJECT_DIR, "templates", "jinja")), extensions=['jinja2.ext.i18n'], trim_blocks=True, auto_reload=False, bytecode_cache=bcc)
+loader = PrefixLoader({
+ "default": FileSystemLoader(join(PROJECT_DIR, "templates", "jinja", "default"))
+ })
+env = Environment(loader=loader, extensions=['jinja2.ext.i18n'], trim_blocks=True, auto_reload=False, bytecode_cache=bcc)
from filters import quotepath, path_make_relative, path_make_absolute, truncate,date