mirror of
https://github.com/osm-search/Nominatim.git
synced 2026-02-26 11:08:13 +00:00
add support for postcompile literals in debug output
This commit is contained in:
@@ -99,6 +99,7 @@ class BaseLogger:
|
|||||||
|
|
||||||
if sa.__version__.startswith('1'):
|
if sa.__version__.startswith('1'):
|
||||||
try:
|
try:
|
||||||
|
sqlstr = re.sub(r'__\[POSTCOMPILE_[^]]*\]', '%s', sqlstr)
|
||||||
return sqlstr % tuple((repr(params.get(name, None))
|
return sqlstr % tuple((repr(params.get(name, None))
|
||||||
for name in compiled.positiontup)) # type: ignore
|
for name in compiled.positiontup)) # type: ignore
|
||||||
except TypeError:
|
except TypeError:
|
||||||
@@ -107,9 +108,10 @@ class BaseLogger:
|
|||||||
# Fixes an odd issue with Python 3.7 where percentages are not
|
# Fixes an odd issue with Python 3.7 where percentages are not
|
||||||
# quoted correctly.
|
# quoted correctly.
|
||||||
sqlstr = re.sub(r'%(?!\()', '%%', sqlstr)
|
sqlstr = re.sub(r'%(?!\()', '%%', sqlstr)
|
||||||
|
sqlstr = re.sub(r'__\[POSTCOMPILE_([^]]*)\]', r'%(\1)s', sqlstr)
|
||||||
|
print(sqlstr)
|
||||||
return sqlstr % params
|
return sqlstr % params
|
||||||
|
|
||||||
|
|
||||||
class HTMLLogger(BaseLogger):
|
class HTMLLogger(BaseLogger):
|
||||||
""" Logger that formats messages in HTML.
|
""" Logger that formats messages in HTML.
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user