This gets us out of a TypeError we're hitting:
TypeError: can only concatenate tuple (not "list") to tuple
Would be nice not to restrict the configuration value to tuples only. E.g.:
ADDITIONAL_RESULT_OUTCOMES = app.config.get('ADDITIONAL_RESULT_OUTCOMES', []) RESULT_OUTCOME = tuple(itertools.chain(PRESET_OUTCOMES, ADDITIONAL_RESULT_OUTCOMES))
@ralph this IMO is not really a proper solution. AFAIU this will break again, when you set the ADDITIONAL_RESULT_OUTCOMES as list, instead of tuple in the config file, so it lacks some robustness to me (as noted by @lholecek)
ADDITIONAL_RESULT_OUTCOMES
@lholecek I might be missing something, but why use tuple(itertools.chain(...)) instead of RESULT_OUTCOME = PRESET_OUTCOMES + tuple(ADDITIONAL_RESULT_OUTCOMES)? Not that I have a huge issue with that, just don't see the added value.
tuple(itertools.chain(...))
RESULT_OUTCOME = PRESET_OUTCOMES + tuple(ADDITIONAL_RESULT_OUTCOMES)
@jskladan The original problem was:
>>> list() + tuple() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate list (not "tuple") to list
@jskladan Oh, sorry, disregard my previous comment. I think you understood it. Your solution is probably nicer (RESULT_OUTCOME = PRESET_OUTCOMES + tuple(ADDITIONAL_RESULT_OUTCOMES)).
Will adjust. Thanks guys!
rebased onto 493ed8985c3436f31a343faa235e1f05210d8d74
OK. Updated.
Awesome, thanks! /merging
\ó/
Merged by https://pagure.io/taskotron/resultsdb/c/70c1ec66bb0b4b827f8f49f19c6fdaec2c61b892?branch=develop
Pull-Request has been closed by jskladan
This gets us out of a TypeError we're hitting:
TypeError: can only concatenate tuple (not "list") to tuple