@@ -309,17 +309,17 @@ class CookieError(Exception):
309309 }
310310
311311def _quote (str , LegalChars = _LegalChars ,
312- join = string .join , idmap = string ._idmap , translate = string .translate ):
312+ join = string .join , idmap = string ._idmap , translate = string .translate ):
313313 #
314314 # If the string does not need to be double-quoted,
315315 # then just return the string. Otherwise, surround
316316 # the string in doublequotes and precede quote (with a \)
317317 # special characters.
318318 #
319319 if "" == translate (str , idmap , LegalChars ):
320- return str
320+ return str
321321 else :
322- return '"' + join ( map (_Translator .get , str , str ), "" ) + '"'
322+ return '"' + join ( map (_Translator .get , str , str ), "" ) + '"'
323323# end _quote
324324
325325
@@ -339,7 +339,7 @@ def _unquote(str, join=string.join, atoi=string.atoi):
339339
340340 # Remove the "s
341341 str = str [1 :- 1 ]
342-
342+
343343 # Check for special sequences. Examples:
344344 # \012 --> \n
345345 # \" --> "
@@ -421,7 +421,7 @@ class Morsel(UserDict):
421421 "version" : "Version" ,
422422 }
423423 _reserved_keys = _reserved .keys ()
424-
424+
425425 def __init__ (self ):
426426 # Set defaults
427427 self .key = self .value = self .coded_value = None
@@ -440,7 +440,7 @@ def __setitem__(self, K, V):
440440 # end __setitem__
441441
442442 def isReservedKey (self , K ):
443- return string .lower (K ) in self ._reserved_keys
443+ return string .lower (K ) in self ._reserved_keys
444444 # end isReservedKey
445445
446446 def set (self , key , val , coded_val ,
@@ -467,7 +467,7 @@ def output(self, attrs=None, header = "Set-Cookie:"):
467467 def __repr__ (self ):
468468 return '<%s: %s=%s>' % (self .__class__ .__name__ ,
469469 self .key , repr (self .value ) )
470-
470+
471471 def js_output (self , attrs = None ):
472472 # Print javascript
473473 return """
@@ -484,7 +484,7 @@ def OutputString(self, attrs=None):
484484 #
485485 result = []
486486 RA = result .append
487-
487+
488488 # First, the key=value pair
489489 RA ("%s=%s;" % (self .key , self .coded_value ))
490490
@@ -502,7 +502,7 @@ def OutputString(self, attrs=None):
502502 RA ("%s;" % self ._reserved [K ])
503503 else :
504504 RA ("%s=%s;" % (self ._reserved [K ], V ))
505-
505+
506506 # Return the result
507507 return string .join (result , " " )
508508 # end OutputString
@@ -542,7 +542,7 @@ def OutputString(self, attrs=None):
542542class BaseCookie (UserDict ):
543543 # A container class for a set of Morsels
544544 #
545-
545+
546546 def value_decode (self , val ):
547547 """real_value, coded_value = value_decode(STRING)
548548 Called prior to setting a cookie's value from the network
@@ -562,7 +562,7 @@ def value_encode(self, val):
562562 strval = str (val )
563563 return strval , strval
564564 # end value_encode
565-
565+
566566 def __init__ (self , input = None ):
567567 UserDict .__init__ (self )
568568 if input : self .load (input )
@@ -596,7 +596,7 @@ def __repr__(self):
596596 for K ,V in self .items ():
597597 L .append ( '%s=%s' % (K ,repr (V .value ) ) )
598598 return '<%s: %s>' % (self .__class__ .__name__ , string .join (L ))
599-
599+
600600 def js_output (self , attrs = None ):
601601 """Return a string suitable for JavaScript."""
602602 result = []
@@ -617,7 +617,7 @@ def load(self, rawdata):
617617 self .update (rawdata )
618618 return
619619 # end load()
620-
620+
621621 def __ParseString (self , str , patt = _CookiePattern ):
622622 i = 0 # Our starting point
623623 n = len (str ) # Length of string
@@ -645,8 +645,6 @@ def __ParseString(self, str, patt=_CookiePattern):
645645 rval , cval = self .value_decode (V )
646646 self .__set (K , rval , cval )
647647 M = self [K ]
648-
649- return
650648 # end __ParseString
651649# end BaseCookie class
652650
@@ -674,7 +672,7 @@ class SerialCookie(BaseCookie):
674672
675673 Note: Large cookie values add overhead because they must be
676674 retransmitted on every HTTP transaction.
677-
675+
678676 Note: HTTP has a 2k limit on the size of a cookie. This class
679677 does not check for this limit, so be careful!!!
680678 """
@@ -694,7 +692,7 @@ class SmartCookie(BaseCookie):
694692
695693 Note: Large cookie values add overhead because they must be
696694 retransmitted on every HTTP transaction.
697-
695+
698696 Note: HTTP has a 2k limit on the size of a cookie. This class
699697 does not check for this limit, so be careful!!!
700698 """
@@ -723,10 +721,6 @@ def value_encode(self, val):
723721
724722
725723
726- #
727- # should add a test routine?
728- #
729-
730724#Local Variables:
731725#tab-width: 4
732726#end:
0 commit comments