Use logging.warning instead of deprecated logging.warn.

This commit is contained in:
Sergio Martínez Portela 2022-11-09 01:01:49 +01:00
parent 4849128fcd
commit ac445d2e7c

View File

@ -115,7 +115,7 @@ def regen_all(src_top, dest_top, *, docs=None, db=None):
cur.execute('DELETE FROM note_search;')
cleaned_db = True
except sqlite3.OperationalError as err:
logging.warn("Error pre-cleaning DB, search won't be updated")
logging.warning("Error pre-cleaning DB, search won't be updated")
docs = load_all(src_top)
doc_to_headline_remapping = {}
@ -497,21 +497,21 @@ def render_text_tokens(tokens, acc, headline, graph):
link_target = './' + link_target[3:] + '.node.html'
elif link_target.startswith('./') or link_target.startswith('../'):
if '::' in link_target:
logging.warn('Not implemented headline links to other files. Used on {}'.format(link_target))
logging.warning('Not implemented headline links to other files. Used on {}'.format(link_target))
else:
target_path = os.path.abspath(os.path.join(os.path.dirname(headline.doc.path), link_target))
if target_path not in graph['main_headlines']:
logging.warn('Link to doc not in graph: {}'.format(target_path))
logging.warning('Link to doc not in graph: {}'.format(target_path))
else:
assert_id_exists(graph['main_headlines'][target_path].id, headline, graph)
link_target = './' + graph['main_headlines'][target_path].id + '.node.html'
elif link_target.startswith('attachment:'):
logging.warn('Not implemented `attachment:` links. Used on {}'.format(link_target))
logging.warning('Not implemented `attachment:` links. Used on {}'.format(link_target))
elif link_target.startswith('* '):
target_headline = get_headline_with_name(link_target.lstrip('* '), headline.doc)
if target_headline is None:
logging.warn('No headline found corresponding to {}. On file {}'.format(link_target, headline.doc.path))
logging.warning('No headline found corresponding to {}. On file {}'.format(link_target, headline.doc.path))
else:
assert_id_exists(target_headline.id, headline, graph)
link_target = './' + target_headline.id + '.node.html'