Skip to content

Commit 7035125

Browse files
committed
Handle with try/except instead
1 parent 5c8b4dc commit 7035125

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

jinja2cli/cli.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -370,11 +370,12 @@ def cli(opts, args):
370370
def parse_kv_string(pairs):
371371
dict_ = {}
372372
for pair in pairs:
373-
if "=" not in pair:
374-
dict_[force_text(pair)] = None
375-
continue
376-
k, v = pair.split("=", 1)
377-
dict_[force_text(k)] = force_text(v)
373+
pair = force_text(pair)
374+
try:
375+
k, v = pair.split("=", 1)
376+
except ValueError:
377+
k, v = pair, None
378+
dict_[k] = v
378379
return dict_
379380

380381

0 commit comments

Comments
 (0)