From 0896703f0d559546999dd41e5305a1597d644bb1 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 28 Nov 2019 15:28:33 +0800 Subject: [PATCH] checkifchange --- ahserver/functionProcessor.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 ahserver/functionProcessor.py diff --git a/ahserver/functionProcessor.py b/ahserver/functionProcessor.py new file mode 100644 index 0000000..238513e --- /dev/null +++ b/ahserver/functionProcessor.py @@ -0,0 +1,28 @@ + +from appPublic.dictObject import DictObject +from appPublic.registerfunction import RegisterFunction + +from aiohttp.web_response import Response, StreamResponse +from .baseProcessor import BaseProcessor + +class FunctionProcessor(BaseProcessor): + @classmethod + def isMe(self,name): + return False + + def __init__(self,path,resource, opts): + self.config_opts = opts + + async def datahandle(self,request): + ns = self.config_opts.options.copy() + ns.update(self.run_ns) + ns = DictObject(ns) + fname = self.config_opts.registerfunction + rf = RegisterFunction() + f = rf.get(fname) + x = await f(ns) + if isinstance(x,Response): + self.retResponse = x + else: + self.content = x +