From 2b62d173eae3a99ea0a815a775d04b36c6548ff0 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 19 Dec 2020 14:00:04 +0800 Subject: [PATCH] bugifx --- ahserver/baseProcessor.py | 8 +++++--- ahserver/processorResource.py | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ahserver/baseProcessor.py b/ahserver/baseProcessor.py index 59ce1ee..68bb35e 100644 --- a/ahserver/baseProcessor.py +++ b/ahserver/baseProcessor.py @@ -60,8 +60,7 @@ class BaseProcessor: } self.content = '' - - async def execute(self,request): + async def set_run_env(self, request): g = ServerEnv() self.run_ns = {} self.run_ns.update(g) @@ -69,6 +68,9 @@ class BaseProcessor: self.run_ns['request'] = request self.run_ns['params_kw'] = await self.run_ns['request2ns']() self.run_ns['ref_real_path'] = self.path + + async def execute(self,request): + await self.set_run_env(request) await self.datahandle(request) return self.content @@ -154,7 +156,7 @@ class PythonScriptProcessor(BaseProcessor): return txt async def path_call(self, request, path): - g = ServerEnv() + await self.set_run_env(request) lenv = self.run_ns del lenv['request'] txt = self.loadScript(path) diff --git a/ahserver/processorResource.py b/ahserver/processorResource.py index dc18761..d660417 100644 --- a/ahserver/processorResource.py +++ b/ahserver/processorResource.py @@ -264,7 +264,9 @@ class ProcessorResource(StaticResource,Url2File): async def path_call(self,request, path, params={}): processor = self.url2processor(request, path) - return await processor.path_call(request, path) + real_path = self.url2file(path) + print('processorResource.py:real_path=',real_path) + return await processor.path_call(request, real_path) def url_call(self,request, url,params={}): processor = self.url2processor(request, url)