use format for name_template

This commit is contained in:
Tomas Kopecek 2021-06-03 09:50:28 +02:00
parent d1d07c1c0c
commit 4892b4e922
2 changed files with 4 additions and 4 deletions

View file

@ -6,4 +6,4 @@ remove_empty = off
# template for sidetag names. It must contain basetag and tag_id parts
# if allowed_suffixes is not empty and suffix was requested, it will be added
# as {name_template}-{suffix}. (percent-signs need to be escaped)
# name_template = %%(basetag)s-sidetag-%%(tag_id)d
# name_template = {basetag}-side-{tag_id}

View file

@ -118,7 +118,7 @@ def createSideTag(basetag, debuginfo=False, suffix=None):
# ugly, it will waste one number in tag_id_seq, but result will match with
# id assigned by _create_tag
tag_id = nextval("tag_id_seq") + 1
sidetag_name = NAME_TEMPLATE % {'basetag': basetag["name"], 'tag_id': tag_id}
sidetag_name = NAME_TEMPLATE.format(basetag=basetag["name"], tag_id=tag_id)
if suffix:
sidetag_name += '-%s' % suffix
extra = {
@ -313,7 +313,7 @@ def handle_sidetag_untag(cbtype, *args, **kws):
# read config and register
if not CONFIG:
CONFIG = koji.read_config_files(CONFIG_FILE)
CONFIG = koji.read_config_files(CONFIG_FILE, raw=True)
print(open(CONFIG_FILE).read())
if CONFIG.has_option("sidetag", "remove_empty") and CONFIG.getboolean(
"sidetag", "remove_empty"
@ -324,4 +324,4 @@ if not CONFIG:
if CONFIG.has_option("sidetag", "name_template"):
NAME_TEMPLATE = CONFIG.get("sidetag", "name_template")
else:
NAME_TEMPLATE = '%(basetag)s-side-%(tag_id)d'
NAME_TEMPLATE = '{basetag}-side-{tag_id}'