Compare commits

...

2 Commits

Author SHA1 Message Date
yumoqing
f67393174b bugfix 2024-08-03 18:49:43 +08:00
yumoqing
a88b3f90fe bugfix 2024-08-03 18:48:56 +08:00

View File

@ -2,6 +2,7 @@
import inspect import inspect
from appPublic.dictObject import DictObject from appPublic.dictObject import DictObject
from appPublic.registerfunction import RegisterFunction from appPublic.registerfunction import RegisterFunction
from appPublic.log import info, debug, warning, error, exception, critical
from aiohttp import web from aiohttp import web
from aiohttp.web_response import Response, StreamResponse from aiohttp.web_response import Response, StreamResponse
from .baseProcessor import BaseProcessor from .baseProcessor import BaseProcessor
@ -28,11 +29,14 @@ class FunctionProcessor(BaseProcessor):
ns = DictObject(**self.run_ns) ns = DictObject(**self.run_ns)
rf = RegisterFunction() rf = RegisterFunction()
f = rf.get(rfname) f = rf.get(rfname)
if f is None:
error(f'{rfname=} is not registered')
return None
self.run_ns['request'] = request self.run_ns['request'] = request
globals().update(self.run_ns) globals().update(self.run_ns)
if inspect.iscoroutinefunction(f): if inspect.iscoroutinefunction(f):
return await f(*args, **self.run_ns) return await f(*args, **self.run_ns)
return f(*args) return f(*args, **self.run_ns)
async def datahandle(self,request): async def datahandle(self,request):
x = await self.path_call(request, self.path) x = await self.path_call(request, self.path)