fixbug
This commit is contained in:
parent
a7adbf9f8f
commit
7110fad601
@ -58,11 +58,11 @@ class BaseProcessor:
|
||||
|
||||
async def handle(self,request):
|
||||
g = ServerEnv()
|
||||
self.run_ns = DictObject()
|
||||
self.run_ns = {}
|
||||
self.run_ns.update(g)
|
||||
self.run_ns.update(self.resource.y_env)
|
||||
self.run_ns.request = request
|
||||
self.run_ns.ref_real_path = self.path
|
||||
self.run_ns['request'] = request
|
||||
self.run_ns['ref_real_path'] = self.path
|
||||
ns = await self.resource.y_env.request2ns()
|
||||
self.run_ns.update(ns)
|
||||
await self.datahandle(request)
|
||||
@ -92,8 +92,7 @@ class TemplateProcessor(BaseProcessor):
|
||||
async def datahandle(self,request):
|
||||
path = request.path
|
||||
ns = self.run_ns
|
||||
te = self.run_ns.tmpl_engine
|
||||
print('ns=',ns)
|
||||
te = self.run_ns['tmpl_engine']
|
||||
self.content = te.render(path,**ns)
|
||||
|
||||
def setheaders(self):
|
||||
|
@ -41,8 +41,8 @@ class TemplateEngine(Environment):
|
||||
return self.loader.join_path(template, parent)
|
||||
|
||||
|
||||
def render(self,name: str, **globals):
|
||||
t = self.get_template(name,globals=globals)
|
||||
def render(self,___name: str, **globals):
|
||||
t = self.get_template(___name,globals=globals)
|
||||
return t.render(globals)
|
||||
|
||||
def setupTemplateEngine():
|
||||
|
Loading…
Reference in New Issue
Block a user