40 if key in self: |
40 if key in self: |
41 raise DuplicateParamError(key) |
41 raise DuplicateParamError(key) |
42 super(UniqueNamespace, self).__setitem__(key, value) |
42 super(UniqueNamespace, self).__setitem__(key, value) |
43 |
43 |
44 # RFC 2616 |
44 # RFC 2616 |
45 separator_chars = "()<>@,;:\\\"/[]?={} \t" # __IGNORE_WARNING__ |
45 separator_chars = "()<>@,;:\\\"/[]?={} \t" # __IGNORE_WARNING_M613__ |
46 ctl_chars = ''.join(chr(i) for i in range(32)) + chr(127) |
46 ctl_chars = ''.join(chr(i) for i in range(32)) + chr(127) |
47 nontoken_chars = separator_chars + ctl_chars |
47 nontoken_chars = separator_chars + ctl_chars |
48 |
48 |
49 # RFC 5987 |
49 # RFC 5987 |
50 attr_chars_nonalnum = '!#$&+-.^_`|~' |
50 attr_chars_nonalnum = '!#$&+-.^_`|~' |
51 attr_chars = string.ascii_letters + string.digits + attr_chars_nonalnum |
51 attr_chars = string.ascii_letters + string.digits + attr_chars_nonalnum |
52 |
52 |
53 # RFC 5987 gives this alternative construction of the token character class |
53 # RFC 5987 gives this alternative construction of the token character class |
54 token_chars = attr_chars + "*'%" # __IGNORE_WARNING__ |
54 token_chars = attr_chars + "*'%" # __IGNORE_WARNING_M601__ |
55 |
55 |
56 # Definitions from https://tools.ietf.org/html/rfc2616#section-2.2 |
56 # Definitions from https://tools.ietf.org/html/rfc2616#section-2.2 |
57 # token was redefined from attr_chars to avoid using AnyBut, |
57 # token was redefined from attr_chars to avoid using AnyBut, |
58 # which might include non-ascii octets. |
58 # which might include non-ascii octets. |
59 token_re = '[{0}]+'.format(re.escape(token_chars)) |
59 token_re = '[{0}]+'.format(re.escape(token_chars)) |