Skip to content

Commit

Permalink
python 3.x support for LenientCookies
Browse files Browse the repository at this point in the history
  • Loading branch information
jamur2 committed Jul 26, 2013
1 parent 959e33e commit 36ea09f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/zope/publisher/http.py
Expand Up @@ -176,7 +176,7 @@ def __setitem__(self, key, value):
rval, cval = self.value_encode(value)
try:
self._BaseCookie__set(key, rval, cval)
except cookies.CookieError, e:
except cookies.CookieError as e:
eventlog.warning(e)

def _BaseCookie__ParseString(self, str, patt=cookies._CookiePattern):
Expand Down Expand Up @@ -211,9 +211,13 @@ def _BaseCookie__ParseString(self, str, patt=cookies._CookiePattern):
try:
self._BaseCookie__set(K, rval, cval)
M = self[K]
except cookies.CookieError, e:
except cookies.CookieError as e:
eventlog.warning(e)

def _BaseCookie__parse_string(self, str, patt=cookies._CookiePattern):
# Python 3.x support
self._BaseCookie__ParseString(str, patt)


class URLGetter(object):

Expand Down Expand Up @@ -465,7 +469,7 @@ def _parseCookies(self, text, result=None):
# ignore cookies on a CookieError
try:
c = LenientCookie(text)
except cookies.CookieError, e:
except cookies.CookieError as e:
eventlog.warn(e)
return result

Expand Down Expand Up @@ -974,8 +978,8 @@ def redirect(self, location, status=None, trusted=False):

def _cookie_list(self):
try:
c = cookies.SimpleCookie()
except cookies.CookieError, e:
c = LenientCookie()
except cookies.CookieError as e:
eventlog.warn(e)
return []
for name, attrs in self._cookies.items():
Expand Down

0 comments on commit 36ea09f

Please sign in to comment.