This commit is contained in:
yumoqing 2023-05-29 22:58:31 +08:00
parent 5b61e749f4
commit 7ccc1de134
2 changed files with 3 additions and 8 deletions

View File

@ -22,7 +22,7 @@ class TmpFileRecord:
self.filename = self.savefilename() self.filename = self.savefilename()
self.loop = asyncio.get_event_loop() self.loop = asyncio.get_event_loop()
self.loop.call_later(0.01, self.load) self.loop.call_later(0.01, self.load)
print('TmpFileRecord() .........................') # print('TmpFileRecord() .........................')
def newtmpfile(self, path:str): def newtmpfile(self, path:str):
self.filetime[path] = time.time() self.filetime[path] = time.time()
@ -44,7 +44,7 @@ class TmpFileRecord:
self.change_flg = False self.change_flg = False
async def load(self): async def load(self):
print('load() called ............') # print('load() called ............')
fn = self.filename fn = self.filename
if not os.path.isfile(fn): if not os.path.isfile(fn):
return return
@ -110,6 +110,6 @@ class FileStorage:
siz += len(d); siz += len(d);
await f.write(d) await f.write(d)
await f.flush() await f.flush()
print(f'{name=} file({fpath}) write {siz} bytes') # print(f'{name=} file({fpath}) write {siz} bytes')
self.tfr.newtmpfile(fpath) self.tfr.newtmpfile(fpath)
return fpath return fpath

View File

@ -102,7 +102,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
def abspath(self, request, path:str): def abspath(self, request, path:str):
url = self.entireUrl(request, path) url = self.entireUrl(request, path)
fname = self.url2file(url) fname = self.url2file(url)
print(f'abspath():, {path=}, {url=}, {fname=}')
return fname return fname
async def getPostData(self,request: Request) -> dict: async def getPostData(self,request: Request) -> dict:
@ -227,7 +226,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
self.user = await auth.get_auth(request) self.user = await auth.get_auth(request)
self.y_env.user = self.user self.y_env.user = self.user
self.request_filename = self.url2file(str(request.path)) self.request_filename = self.url2file(str(request.path))
print(f'225:{request.path=}, {self.request_filename=}')
path = request.path path = request.path
config = getConfig() config = getConfig()
if config.website.dbadm and path.startswith(config.website.dbadm): if config.website.dbadm and path.startswith(config.website.dbadm):
@ -312,13 +310,11 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
return False return False
def url2processor(self, request, url, fpath): def url2processor(self, request, url, fpath):
print('fpath=', fpath)
config = getConfig() config = getConfig()
url = self.entireUrl(request, url) url = self.entireUrl(request, url)
host = '/'.join(str(request.url).split('/')[:3]) host = '/'.join(str(request.url).split('/')[:3])
path = request.path path = request.path
real_path = self.abspath(request, path) real_path = self.abspath(request, path)
print(f'url2processor():{path=}, {real_path=}')
if config.website.startswiths: if config.website.startswiths:
for a in config.website.startswiths: for a in config.website.startswiths:
if path.startswith(a.leading): if path.startswith(a.leading):
@ -351,7 +347,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
async def path_call(self, request, path, params={}): async def path_call(self, request, path, params={}):
url = self.entireUrl(request, path) url = self.entireUrl(request, path)
fpath = self.url2file(url) fpath = self.url2file(url)
print(f'path_call():{path=}, {url=}, {fpath=}')
processor = self.url2processor(request, url, fpath) processor = self.url2processor(request, url, fpath)
return await processor.path_call(request, params=params) return await processor.path_call(request, params=params)