This commit is contained in:
yumoqing 2024-02-19 12:06:22 +08:00
parent 01c7ef6c7a
commit 166e92f7ff

View File

@ -409,23 +409,27 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
url.startswith('wss://'):
return url
if url.startswith('/'):
return f'{self._prepath}{url}'
u = f'{self._preurl}{url}'
print(f'entireUrl(), {u=}, {url=}, {self._preurl=}')
return u
path = request.path
p = self.relatedurl(path,url)
return f'{self._prepath}{p}'
u = f'{self._preurl}{p}'
print(f'entireUrl(), {u=}, {url=}, {self._preurl=}')
return u
def url2path(self, url):
if url.startswith(self._prepath):
return url[len(self._prepath):]
if url.startswith(self._preurl):
return url[len(self._preurl):]
return url
async def path_call(self, request, path, params={}):
url = self.entireUrl(request, path)
# print(f'{path=}, after entireUrl(), {url=}')
path = self.url2path(url)
print(f'{path=}, after entireUrl(), {url=}')
# path = self.url2path(url)
fpath = self.url2file(path)
processor = self.url2processor(request, url, fpath)
print(f'path_call(), {path=}, {url=}, {fpath=}, {processor=}')
processor = self.url2processor(request, path, fpath)
print(f'path_call(), {path=}, {url=}, {fpath=}, {processor=}, {self._prepath}')
new_request = request.clone(rel_url=url)
# new_request.path = path
return await processor.be_call(new_request, params=params)