Compare commits

..

No commits in common. "21143f01383f29a03c2117923f29cccf19a5eaae" and "95ce48725843e37122546abaef1d6e468575fd3c" have entirely different histories.

3 changed files with 6 additions and 29 deletions

View File

@ -136,7 +136,7 @@ class TemplateProcessor(BaseProcessor):
url = self.resource.entireUrl(request, path)
ns = self.run_ns
te = self.run_ns['tmpl_engine']
# print(f'{url=}, {path=}')
print(f'{url=}, {path=}')
# return await te.render(url,**ns)
return await te.render(path,**ns)
@ -155,7 +155,7 @@ class TemplateProcessor(BaseProcessor):
class BricksUIProcessor(TemplateProcessor):
@classmethod
def isMe(self,name):
# print(f'{name=} is a bui')
print(f'{name=} is a bui')
return name=='bui'
async def datahandle(self, request):
@ -215,7 +215,7 @@ class MarkdownProcessor(BaseProcessor):
mdtxt)
def getProcessor(name):
# print(f'getProcessor({name})')
print(f'getProcessor({name})')
return _getProcessor(BaseProcessor, name)
def _getProcessor(kclass,name):

View File

@ -18,7 +18,7 @@ class TmplLoader(BaseLoader, TmplUrl2File):
coding = config.website.coding
fp = self.url2file(template)
# print(f'{template=} can not transfer to filename')
print(f'{template=} can not transfer to filename')
if not os.path.isfile(fp):
raise TemplateNotFound(template)
mtime = os.path.getmtime(fp)

View File

@ -167,27 +167,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
# print(f'getPostData():{ns=}')
return ns
def parse_request(self, request):
"""
get real schema, host, port, prepath
and save it to self._{attr}
"""
self._scheme = request.scheme
self._scheme = request.headers.get('X-Forwarded-Scheme',request.scheme)
k = request.host.split(':')
host = k[0]
port = 80
if len(k) == 2:
port = int(k[1])
elif self._scheme.lower() == 'https':
port = 443
self._host = request.headers.get('X-Forwarded-Host', host)
self._port = request.headers.get('X-Forwarded-Port', port)
self._prepath = request.headers.get('X-Forwarded-Prepath', '')
async def _handle(self,request:Request) -> StreamResponse:
clientkeys = {
"iPhone":"iphone",
@ -252,8 +231,6 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
async def get_user():
return await auth.get_auth(request)
self.parse_request(request)
self.y_env.i18n = serveri18n
self.y_env.file_realpath = file_realpath
self.y_env.redirect = redirect
@ -324,7 +301,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
if not config.website.allowListFolder:
self.error('%s:not found' % str(request.url))
raise HTTPNotFound
# print(f'{self.request_filename=}, {str(request.url)=} handle as a normal file')
print(f'{self.request_filename=}, {str(request.url)=} handle as a normal file')
return await super()._handle(request)
def gethost(self, request):
@ -416,7 +393,7 @@ class ProcessorResource(AppLogger, StaticResource,Url2File):
async def path_call(self, request, path, params={}):
url = self.entireUrl(request, path)
# print(f'{path=}, after entireUrl(), {url=}')
print(f'{path=}, after entireUrl(), {url=}')
fpath = self.url2file(url)
processor = self.url2processor(request, url, fpath)
new_request = request.clone(rel_url=url)