[Python-checkins] r74648 - python/branches/py3k/Lib/http/cookies.py

georg.brandl python-checkins at python.org
Fri Sep 4 10:22:01 CEST 2009


Author: georg.brandl
Date: Fri Sep 4 10:22:00 2009
New Revision: 74648
Log:
Remove pseudo-end markers from http.cookies.
Modified:
 python/branches/py3k/Lib/http/cookies.py
Modified: python/branches/py3k/Lib/http/cookies.py
==============================================================================
--- python/branches/py3k/Lib/http/cookies.py	(original)
+++ python/branches/py3k/Lib/http/cookies.py	Fri Sep 4 10:22:00 2009
@@ -236,7 +236,6 @@
 return str
 else:
 return '"' + _nulljoin( map(_Translator.get, str, str) ) + '"'
-# end _quote
 
 
 _OctalPatt = re.compile(r"\\[0-3][0-7][0-7]")
@@ -282,7 +281,6 @@
 res.append( chr( int(str[j+1:j+4], 8) ) )
 i = j+4
 return _nulljoin(res)
-# end _unquote
 
 # The _getdate() routine is used to set the expiration time in
 # the cookie's HTTP header. By default, _getdate() returns the
@@ -348,18 +346,15 @@
 # Set default attributes
 for K in self._reserved:
 dict.__setitem__(self, K, "")
- # end __init__
 
 def __setitem__(self, K, V):
 K = K.lower()
 if not K in self._reserved:
 raise CookieError("Invalid Attribute %s" % K)
 dict.__setitem__(self, K, V)
- # end __setitem__
 
 def isReservedKey(self, K):
 return K.lower() in self._reserved
- # end isReservedKey
 
 def set(self, key, val, coded_val, LegalChars=_LegalChars):
 # First we verify that the key isn't a reserved word
@@ -373,7 +368,6 @@
 self.key = key
 self.value = val
 self.coded_value = coded_val
- # end set
 
 def output(self, attrs=None, header = "Set-Cookie:"):
 return "%s %s" % ( header, self.OutputString(attrs) )
@@ -393,7 +387,6 @@
 // end hiding -->
 </script>
 """ % ( self.OutputString(attrs).replace('"',r'\"'))
- # end js_output()
 
 def OutputString(self, attrs=None):
 # Build up our result
@@ -424,9 +417,6 @@
 
 # Return the result
 return _semispacejoin(result)
- # end OutputString
-# end Morsel class
-
 
 
 #
@@ -470,7 +460,6 @@
 Override this function to modify the behavior of cookies.
 """
 return val, val
- # end value_encode
 
 def value_encode(self, val):
 """real_value, coded_value = value_encode(VALUE)
@@ -480,24 +469,20 @@
 """
 strval = str(val)
 return strval, strval
- # end value_encode
 
 def __init__(self, input=None):
 if input: self.load(input)
- # end __init__
 
 def __set(self, key, real_value, coded_value):
 """Private method for setting a cookie's value"""
 M = self.get(key, Morsel())
 M.set(key, real_value, coded_value)
 dict.__setitem__(self, key, M)
- # end __set
 
 def __setitem__(self, key, value):
 """Dictionary style assignment."""
 rval, cval = self.value_encode(value)
 self.__set(key, rval, cval)
- # end __setitem__
 
 def output(self, attrs=None, header="Set-Cookie:", sep="015円012円"):
 """Return a string suitable for HTTP."""
@@ -506,7 +491,6 @@
 for K,V in items:
 result.append( V.output(attrs, header) )
 return sep.join(result)
- # end output
 
 __str__ = output
 
@@ -524,7 +508,6 @@
 for K,V in items:
 result.append( V.js_output(attrs) )
 return _nulljoin(result)
- # end js_output
 
 def load(self, rawdata):
 """Load cookies from a string (presumably HTTP_COOKIE) or
@@ -537,7 +520,6 @@
 else:
 self.update(rawdata)
 return
- # end load()
 
 def __ParseString(self, str, patt=_CookiePattern):
 i = 0 # Our starting point
@@ -566,8 +548,7 @@
 rval, cval = self.value_decode(V)
 self.__set(K, rval, cval)
 M = self[K]
- # end __ParseString
-# end BaseCookie class
+
 
 class SimpleCookie(BaseCookie):
 """SimpleCookie
@@ -581,9 +562,7 @@
 def value_encode(self, val):
 strval = str(val)
 return strval, _quote( strval )
-# end SimpleCookie
 
-#
 ###########################################################
 
 def _test():


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /