This commit is contained in:
yumoqing 2023-12-18 22:15:24 +08:00
parent ab900123aa
commit 27ea6eb99e
2 changed files with 2 additions and 7 deletions

View File

@ -13,6 +13,7 @@ from appPublic.app_logger import AppLogger
from .utils import unicode_escape from .utils import unicode_escape
from .serverenv import ServerEnv from .serverenv import ServerEnv
from .filetest import current_fileno
class ObjectCache: class ObjectCache:
def __init__(self): def __init__(self):

View File

@ -229,7 +229,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
async def get_user(): async def get_user():
return await auth.get_auth(request) return await auth.get_auth(request)
f_cnt1 = current_fileno()
self.y_env.i18n = serveri18n self.y_env.i18n = serveri18n
self.y_env.file_realpath = file_realpath self.y_env.file_realpath = file_realpath
self.y_env.redirect = redirect self.y_env.redirect = redirect
@ -255,7 +254,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
request['request_filename'] = self.request_filename request['request_filename'] = self.request_filename
path = request.path path = request.path
config = getConfig() config = getConfig()
f_cnt2 = current_fileno()
request['port'] = config.website.port request['port'] = config.website.port
if config.website.dbadm and path.startswith(config.website.dbadm): if config.website.dbadm and path.startswith(config.website.dbadm):
pp = path.split('/')[2:] pp = path.split('/')[2:]
@ -267,7 +265,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
action = pp[2] action = pp[2]
adm = DBAdmin(request,dbname,tablename,action) adm = DBAdmin(request,dbname,tablename,action)
return await adm.render() return await adm.render()
f_cnt3 = current_fileno()
if config.website.dbrest and path.startswith(config.website.dbrest): if config.website.dbrest and path.startswith(config.website.dbrest):
pp = path.split('/')[2:] pp = path.split('/')[2:]
if len(pp)<2: if len(pp)<2:
@ -280,7 +277,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
id = pp[2] id = pp[2]
crud = DBCrud(request,dbname,tablename,id=id) crud = DBCrud(request,dbname,tablename,id=id)
return await crud.dispatch() return await crud.dispatch()
f_cnt4 = current_fileno()
if config.website.download and path.startswith(config.website.download): if config.website.download and path.startswith(config.website.download):
pp = path.split('/')[2:] pp = path.split('/')[2:]
if len(pp)<1: if len(pp)<1:
@ -290,13 +286,10 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
path = path_decode(dp) path = path_decode(dp)
return await file_download(request, path) return await file_download(request, path)
f_cnt5 = current_fileno()
# processor = self.url2processor(request, str(request.url)) # processor = self.url2processor(request, str(request.url))
processor = self.url2processor(request, str(request.url), self.request_filename) processor = self.url2processor(request, str(request.url), self.request_filename)
if processor: if processor:
ret = await processor.handle(request) ret = await processor.handle(request)
f_cnt6 = current_fileno()
print(f'{f_cnt1=}, {f_cnt2=}, {f_cnt3=}, {f_cnt4=}, {f_cnt5=}, {f_cnt6=}')
return ret return ret
f_cnt6 = current_fileno() f_cnt6 = current_fileno()
@ -368,6 +361,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
Klass = getProcessor(handlername) Klass = getProcessor(handlername)
try: try:
processor = Klass(path,self) processor = Klass(path,self)
# print(f'{f_cnt1=}, {f_cnt2=}, {f_cnt3=}, {f_cnt4=}, {f_cnt5=}')
return processor return processor
except Exception as e: except Exception as e:
print('Exception:',e, 'handlername=', handlername) print('Exception:',e, 'handlername=', handlername)