This commit is contained in:
yumoqing 2024-04-08 18:12:15 +08:00
parent ff5311df85
commit 934d717e78
2 changed files with 8 additions and 10 deletions

View File

@ -68,7 +68,7 @@ class BaseProcessor(AppLogger):
return
self.real_path = self.resource.url2file(request.path)
g = ServerEnv()
self.run_ns = {}
self.run_ns = DictObject()
self.run_ns.update(g)
self.run_ns.update(self.resource.y_env)
self.run_ns['request'] = request

View File

@ -33,6 +33,7 @@ from aiohttp.web_response import Response, StreamResponse
from aiohttp.web_routedef import AbstractRouteDef
from appPublic.jsonConfig import getConfig
from appPublic.dictObject import DictObject
from appPublic.i18n import getI18N
from appPublic.dictObject import DictObject, multiDict2Dict
from appPublic.timecost import TimeCost
@ -43,6 +44,7 @@ from .baseProcessor import getProcessor, BricksUIProcessor, TemplateProcessor
from .baseProcessor import PythonScriptProcessor, MarkdownProcessor
from .xlsxdsProcessor import XLSXDataSourceProcessor
from .llmProcessor import LlmProcessor
from .websocketProcessor import WebsocketProcessor, XtermProcessor
from .sqldsProcessor import SQLDataSourceProcessor
from .functionProcessor import FunctionProcessor
@ -113,7 +115,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
fname = self.url2file(path)
return fname
async def getPostData(self,request: Request) -> dict:
async def getPostData(self,request: Request) -> DictObject:
qd = {}
if request.query:
qd = multiDict2Dict(request.query)
@ -135,8 +137,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
# print('body is not a json')
pass
qd.update(pd)
# print(f'{qd=} reader is None, {pd=}')
return qd
return DictObject(**qd)
ns = qd
while 1:
try:
@ -165,9 +166,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
print_exc()
print('-----------except out ------------')
break;
# showcallstack()
# print(f'getPostData():{ns=}')
return ns
return DictObject(ns)
def parse_request(self, request):
"""
@ -234,12 +233,11 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
return g.myi18n(s,l)
async def getArgs():
ns = DictObject()
async def getArgs() -> DictObject:
if request.method == 'POST':
return await self.getPostData(request)
ns = multiDict2Dict(request.query)
return ns
return DictObject(**ns)
async def redirect(url):
url = self.entireUrl(request, url)