parse_tag_value now deals with bytes.

This commit is contained in:
William Grant
2011-03-19 18:47:51 +11:00
parent 88915e3a01
commit 9af52236fc
2 changed files with 14 additions and 14 deletions
+2 -2
View File
@@ -55,13 +55,13 @@ def parse_tag_value(tag_list):
@param tag_list: A string containing a DKIM Tag=Value list.
"""
tags = {}
tag_specs = tag_list.split(';')
tag_specs = tag_list.split(b';')
# Trailing semicolons are valid.
if not tag_specs[-1]:
tag_specs.pop()
for tag_spec in tag_specs:
try:
key, value = tag_spec.split('=', 1)
key, value = tag_spec.split(b'=', 1)
except ValueError:
raise InvalidTagSpec(tag_spec)
if key.strip() in tags: