add params_kw env var

This commit is contained in:
yumoqing 2020-12-02 04:42:53 +08:00
parent e6b30650c7
commit 809f5160aa
2 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,9 @@ class TemplateProcessor(BaseProcessor):
async def datahandle(self,request): async def datahandle(self,request):
path = request.path path = request.path
request2ns = self.run_ns.get('request2ns')
if request2ns:
self.run_ns['params_kw'] = await request2ns()
ns = self.run_ns ns = self.run_ns
te = self.run_ns['tmpl_engine'] te = self.run_ns['tmpl_engine']
self.content = te.render(path,**ns) self.content = te.render(path,**ns)

View File

@ -45,6 +45,7 @@ def i18nDICT(request):
i18n = getI18N() i18n = getI18N()
lang = getHeaderLang(request) lang = getHeaderLang(request)
l = c.langMapping.get(lang,lang) l = c.langMapping.get(lang,lang)
print('i18nDict():lang=',lang,',l=',l,',dict=',,i18n.getLangDict(l))
return json.dumps(i18n.getLangDict(l)).encode(c.website.coding) return json.dumps(i18n.getLangDict(l)).encode(c.website.coding)