bugfix
This commit is contained in:
parent
4cac3f125c
commit
cbbbc18182
@ -38,7 +38,7 @@ async def file_handle(request, filepath, download=False):
|
|||||||
async def file_download(request, filepath):
|
async def file_download(request, filepath):
|
||||||
return await file_handle(request, filepath, download=True)
|
return await file_handle(request, filepath, download=True)
|
||||||
|
|
||||||
async def path_download(request, kw, *params):
|
async def path_download(request, kw, *params, **kw):
|
||||||
path = kw.get('path')
|
path = kw.get('path')
|
||||||
download = False
|
download = False
|
||||||
if kw.get('download'):
|
if kw.get('download'):
|
||||||
|
@ -39,8 +39,8 @@ class FunctionProcessor(BaseProcessor):
|
|||||||
|
|
||||||
debug(f'params_kw={params_kw}, {args=}')
|
debug(f'params_kw={params_kw}, {args=}')
|
||||||
if inspect.iscoroutinefunction(f):
|
if inspect.iscoroutinefunction(f):
|
||||||
return await f(request, params_kw, *args)
|
return await f(request, params_kw, *args, **self.run_ns)
|
||||||
return f(request, params_kw, *args)
|
return f(request, params_kw, *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)
|
||||||
|
@ -468,6 +468,5 @@ class ProcessorResource(StaticResource,Url2File):
|
|||||||
fpath = self.url2file(path)
|
fpath = self.url2file(path)
|
||||||
processor = self.url2processor(request, path, fpath)
|
processor = self.url2processor(request, path, fpath)
|
||||||
# print(f'path_call(), {path=}, {url=}, {fpath=}, {processor=}, {self._prepath}')
|
# print(f'path_call(), {path=}, {url=}, {fpath=}, {processor=}, {self._prepath}')
|
||||||
new_request = request.clone(rel_url=path)
|
return await processor.be_call(request, params=params)
|
||||||
return await processor.be_call(new_request, params=params)
|
|
||||||
|
|
||||||
|
@ -8,16 +8,15 @@ from ahserver.serverenv import ServerEnv
|
|||||||
from appPublic.jsonConfig import getConfig
|
from appPublic.jsonConfig import getConfig
|
||||||
|
|
||||||
def webapp(init_func):
|
def webapp(init_func):
|
||||||
if parser is None:
|
parser = argparse.ArgumentParser(prog="Sage")
|
||||||
parser = argparse.ArgumentParser(prog="Sage")
|
|
||||||
parser.add_argument('-w', '--workdir')
|
parser.add_argument('-w', '--workdir')
|
||||||
parser.add_argument('-p', '--port')
|
parser.add_argument('-p', '--port')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
workdir = args.workdir or os.getcwd()
|
workdir = args.workdir or os.getcwd()
|
||||||
port = args.port or config.website.port or 8080
|
port = args.port
|
||||||
server(init_func, workdir, port)
|
webserver(init_func, workdir, port)
|
||||||
|
|
||||||
def server(init_func, workdir, port=None):
|
def webserver(init_func, workdir, port=None):
|
||||||
p = ProgramPath()
|
p = ProgramPath()
|
||||||
config = getConfig(workdir, NS={'workdir':workdir, 'ProgramPath':p})
|
config = getConfig(workdir, NS={'workdir':workdir, 'ProgramPath':p})
|
||||||
if config.logger:
|
if config.logger:
|
||||||
|
Loading…
Reference in New Issue
Block a user