Skip to content

Commit ee71cfb

Browse files
committed
improve tag entry
1 parent ec310e5 commit ee71cfb

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

pythonbits/bb.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from .ffmpeg import FFMpeg
2828
from . import templating as bb
2929
from .submission import (Submission, form_field, finalize,
30-
SubmissionAttributeError)
30+
SubmissionAttributeError, rlinput)
3131
from .tracker import Tracker
3232
from .scene import is_scene_crc, query_scene_fname
3333

@@ -1081,10 +1081,19 @@ def _render_form_tags(self):
10811081
'trip.hop'}
10821082
tags = self['summary']['tags']
10831083
if not tags:
1084-
tags = input('No tags found. Please enter tags:').split(',')
1084+
tags = input("No tags found. Please enter tags "
1085+
"(comma-separated): ").split(',')
10851086
tags = set(format_tag(tag) for tag in tags)
1086-
assert tags & _defaults != set()
1087-
return list(tags)
1087+
while True:
1088+
try:
1089+
assert tags & _defaults != set()
1090+
except AssertionError:
1091+
print("Default tags:\n" + ", ".join(sorted(_defaults)))
1092+
print("Submission must contain at least one default tag.")
1093+
tags = rlinput("Enter tags: ", ",".join(tags)).split(',')
1094+
tags = set(format_tag(tag) for tag in tags)
1095+
else:
1096+
return ",".join(tags)
10881097

10891098
def _render_section_information(self):
10901099
release, rg = self['release']

0 commit comments

Comments
 (0)