From 7110fad60148aba8e8f7f62e5e207155a4d12318 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Fri, 29 Nov 2019 18:01:58 +0800 Subject: [PATCH] fixbug --- ahserver/baseProcessor.py | 9 ++++----- ahserver/myTE.py | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/ahserver/baseProcessor.py b/ahserver/baseProcessor.py index 08cc325..528f0d6 100644 --- a/ahserver/baseProcessor.py +++ b/ahserver/baseProcessor.py @@ -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): diff --git a/ahserver/myTE.py b/ahserver/myTE.py index c09da6c..0a3c6ef 100644 --- a/ahserver/myTE.py +++ b/ahserver/myTE.py @@ -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():