This commit is contained in:
yumoqing 2020-12-19 14:00:04 +08:00
parent b089d4f66d
commit 2b62d173ea
2 changed files with 8 additions and 4 deletions

View File

@ -60,8 +60,7 @@ class BaseProcessor:
} }
self.content = '' self.content = ''
async def set_run_env(self, request):
async def execute(self,request):
g = ServerEnv() g = ServerEnv()
self.run_ns = {} self.run_ns = {}
self.run_ns.update(g) self.run_ns.update(g)
@ -69,6 +68,9 @@ class BaseProcessor:
self.run_ns['request'] = request self.run_ns['request'] = request
self.run_ns['params_kw'] = await self.run_ns['request2ns']() self.run_ns['params_kw'] = await self.run_ns['request2ns']()
self.run_ns['ref_real_path'] = self.path self.run_ns['ref_real_path'] = self.path
async def execute(self,request):
await self.set_run_env(request)
await self.datahandle(request) await self.datahandle(request)
return self.content return self.content
@ -154,7 +156,7 @@ class PythonScriptProcessor(BaseProcessor):
return txt return txt
async def path_call(self, request, path): async def path_call(self, request, path):
g = ServerEnv() await self.set_run_env(request)
lenv = self.run_ns lenv = self.run_ns
del lenv['request'] del lenv['request']
txt = self.loadScript(path) txt = self.loadScript(path)

View File

@ -264,7 +264,9 @@ class ProcessorResource(StaticResource,Url2File):
async def path_call(self,request, path, params={}): async def path_call(self,request, path, params={}):
processor = self.url2processor(request, path) 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={}): def url_call(self,request, url,params={}):
processor = self.url2processor(request, url) processor = self.url2processor(request, url)