Added __init__.py and fixes in load_js
This commit is contained in:
parent
c97a49b5a7
commit
ad4326048a
3 changed files with 19 additions and 6 deletions
|
|
@ -8,6 +8,7 @@ from paramecio.citoplasma.i18n import I18n
|
|||
from paramecio.citoplasma.sessions import get_session
|
||||
from paramecio.citoplasma.adminutils import make_admin_url
|
||||
from paramecio.cromosoma.formsutils import csrf_token
|
||||
from paramecio.citoplasma.js import make_js_url
|
||||
from settings import config
|
||||
from os import path
|
||||
from collections import OrderedDict
|
||||
|
|
@ -90,7 +91,7 @@ class PTemplate:
|
|||
module=path.dirname(module)
|
||||
"""
|
||||
|
||||
self.autoescape_ext=('html', 'htm', 'xml', 'phtml', 'pjs')
|
||||
self.autoescape_ext=('html', 'htm', 'xml', 'phtml', 'js')
|
||||
|
||||
"""
|
||||
self.cache_enabled=cache_enabled
|
||||
|
|
@ -123,6 +124,8 @@ class PTemplate:
|
|||
|
||||
self.add_filter(make_admin_url)
|
||||
|
||||
self.add_filter(make_js_url)
|
||||
|
||||
I18n_lang=I18n.lang
|
||||
|
||||
self.add_filter(I18n.lang)
|
||||
|
|
|
|||
0
paramecio/i18n/__init__py
Normal file
0
paramecio/i18n/__init__py
Normal file
|
|
@ -3,6 +3,9 @@
|
|||
from paramecio.wsgiapp import app
|
||||
from paramecio.citoplasma.mtemplates import env_theme, PTemplate
|
||||
from settings import config
|
||||
from paramecio.citoplasma.sessions import get_session
|
||||
from paramecio.citoplasma.i18n import I18n
|
||||
from bottle import response
|
||||
import os
|
||||
|
||||
#t=PTemplate(env)
|
||||
|
|
@ -16,9 +19,14 @@ arr_t={}
|
|||
@app.route('/mediajs/<module>/<lang>/<filename:path>')
|
||||
def send_javascript(module, lang, filename):
|
||||
|
||||
path_module=workdir+'/modules/'+module+'/js/'
|
||||
s=get_session()
|
||||
|
||||
path=workdir+'/themes/'+config.theme+'/js/'+module
|
||||
if lang in I18n.dict_i18n:
|
||||
s['lang']=lang
|
||||
|
||||
path_module='modules/'+module+'/js'
|
||||
|
||||
path='themes/'+config.theme+'/js/'+module
|
||||
|
||||
file_path_module=path_module+'/'+filename
|
||||
file_path_theme=path+'/'+filename
|
||||
|
|
@ -35,4 +43,6 @@ def send_javascript(module, lang, filename):
|
|||
env=env_theme(load_path)
|
||||
arr_t[load_path]=PTemplate(env)
|
||||
|
||||
return arr_t[module].load_template(file_path)
|
||||
response.set_header('Content-type', 'application/javascript')
|
||||
|
||||
return arr_t[load_path].load_template(filename)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue