From 070aa27cf5f88d2036c88c110e00421c427c0c9b Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Wed, 28 Sep 2016 15:10:31 +1000 Subject: parse_set_cookie header returns an empty list if no cookies are found This matches parse_cookie, and is more idiomatic. --- netlib/http/cookies.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'netlib/http') diff --git a/netlib/http/cookies.py b/netlib/http/cookies.py index a3ac4806..cb816ca0 100644 --- a/netlib/http/cookies.py +++ b/netlib/http/cookies.py @@ -241,21 +241,16 @@ def parse_set_cookie_header(line): """ Parse a Set-Cookie header value - Returns a list of (name, value, attrs) tuple for each cokie, or None. - Where attrs is a CookieAttrs dict of attributes. No attempt is made - to parse attribute values - they are treated purely as strings. + Returns a list of (name, value, attrs) tuples, where attrs is a + CookieAttrs dict of attributes. No attempt is made to parse attribute + values - they are treated purely as strings. """ cookie_pairs, off = _read_set_cookie_pairs(line) - cookies = [ (pairs[0][0], pairs[0][1], CookieAttrs(tuple(x) for x in pairs[1:])) for pairs in cookie_pairs if pairs ] - - if cookies: - return cookies - else: - return None + return cookies def parse_set_cookie_headers(headers): -- cgit v1.2.3