checkifchange
This commit is contained in:
parent
18e3ee7d5c
commit
a7adbf9f8f
@ -47,11 +47,10 @@ class BaseProcessor:
|
||||
self.path = path
|
||||
self.resource = resource
|
||||
self.retResponse = None
|
||||
self.last_modified = os.path.getmtime(path)
|
||||
self.content_length = os.path.getsize(path)
|
||||
# self.last_modified = os.path.getmtime(path)
|
||||
# self.content_length = os.path.getsize(path)
|
||||
self.headers = {
|
||||
'Content-Type': 'text/html',
|
||||
'Content-Length': str(self.content_length),
|
||||
'Content-Type': 'text/html; utf-8',
|
||||
'Accept-Ranges': 'bytes'
|
||||
}
|
||||
self.content = ''
|
||||
@ -93,9 +92,9 @@ class TemplateProcessor(BaseProcessor):
|
||||
async def datahandle(self,request):
|
||||
path = request.path
|
||||
ns = self.run_ns
|
||||
te = g.tmpl_engine
|
||||
te = self.run_ns.tmpl_engine
|
||||
print('ns=',ns)
|
||||
self.content = te.render(path,**ns)
|
||||
#self.content = await te.render_async(path,**ns)
|
||||
|
||||
def setheaders(self):
|
||||
super(TemplateProcessor,self).setheaders()
|
||||
@ -125,6 +124,7 @@ class PythonScriptProcessor(BaseProcessor):
|
||||
async def datahandle(self,request):
|
||||
g = ServerEnv()
|
||||
lenv = self.run_ns
|
||||
del lenv['request']
|
||||
if not g.get('dspy_cache',False):
|
||||
g.dspy_cache = ObjectCache()
|
||||
func = g.dspy_cache.get(self.path)
|
||||
|
@ -12,14 +12,14 @@ class FunctionProcessor(BaseProcessor):
|
||||
|
||||
def __init__(self,path,resource, opts):
|
||||
self.config_opts = opts
|
||||
BaseProcessor.__init__(self,path,resource)
|
||||
|
||||
async def datahandle(self,request):
|
||||
ns = self.config_opts.options.copy()
|
||||
ns = self.config_opts.copy()
|
||||
ns.update(self.run_ns)
|
||||
ns = DictObject(ns)
|
||||
fname = self.config_opts.registerfunction
|
||||
ns = DictObject(**ns)
|
||||
rf = RegisterFunction()
|
||||
f = rf.get(fname)
|
||||
f = rf.get(ns.registerfunction)
|
||||
x = await f(ns)
|
||||
if isinstance(x,Response):
|
||||
self.retResponse = x
|
||||
|
Loading…
Reference in New Issue
Block a user