summaryrefslogtreecommitdiff
path: root/webob/cookies.py
diff options
context:
space:
mode:
Diffstat (limited to 'webob/cookies.py')
-rw-r--r--webob/cookies.py25
1 files changed, 16 insertions, 9 deletions
diff --git a/webob/cookies.py b/webob/cookies.py
index 0536725..b602057 100644
--- a/webob/cookies.py
+++ b/webob/cookies.py
@@ -1,5 +1,9 @@
-import re, time, string
-from datetime import datetime, date, timedelta
+import re
+import time
+import string
+from datetime import datetime
+from datetime import date
+from datetime import timedelta
__all__ = ['Cookie']
@@ -36,9 +40,8 @@ class Cookie(dict):
__str__ = serialize
def __repr__(self):
- return '<%s: [%s]>' % (self.__class__.__name__, ', '.join(map(repr, self.values())))
-
-
+ return '<%s: [%s]>' % (self.__class__.__name__,
+ ', '.join(map(repr, self.values())))
def cookie_property(key, serialize=lambda v: v):
@@ -113,7 +116,8 @@ class Morsel(dict):
__str__ = serialize
def __repr__(self):
- return '<%s: %s=%s>' % (self.__class__.__name__, self.name, repr(self.value))
+ return '<%s: %s=%s>' % (self.__class__.__name__,
+ self.name, repr(self.value))
_c_renames = {
"expires" : "expires",
@@ -135,7 +139,8 @@ _c_keys.update(['secure', 'httponly'])
_re_quoted = r'"(?:[^\"]|\.)*"' # any doublequoted string
_legal_special_chars = "~!@#$%^&*()_+=-`.?|:/(){}<>'"
-_re_legal_char = r"[\w\d%s]" % ''.join(map(r'\%s'.__mod__, _legal_special_chars))
+_re_legal_char = r"[\w\d%s]" % ''.join(map(r'\%s'.__mod__,
+ _legal_special_chars))
_re_expires_val = r"\w{3},\s[\w\d-]{9,11}\s[\d:]{8}\sGMT"
_rx_cookie = re.compile(
# key
@@ -169,7 +174,8 @@ _trans_noop = ''.join(chr(x) for x in xrange(256))
# these chars can be in cookie value w/o causing it to be quoted
_no_escape_special_chars = "!#$%&'*+-.^_`|~/"
-_no_escape_chars = string.ascii_letters + string.digits + _no_escape_special_chars
+_no_escape_chars = string.ascii_letters + string.digits + \
+ _no_escape_special_chars
# these chars never need to be quoted
_escape_noop_chars = _no_escape_chars+':, '
# this is a map used to escape the values
@@ -181,7 +187,8 @@ _escape_char = _escape_map.__getitem__
weekdays = ('Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun')
-months = (None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec')
+months = (None, 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
+ 'Oct', 'Nov', 'Dec')
def needs_quoting(v):