[Erp5-report] r23339 - /erp5/trunk/products/ERP5Type/patches/CookieCrumbler.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Tue Sep 2 13:40:17 CEST 2008
Author: yusei
Date: Tue Sep 2 13:40:13 2008
New Revision: 23339
URL: http://svn.erp5.org?rev=23339&view=rev
Log:
Use standard_b64encode, standard_b64decode instead of encodestring, decodestring.
Modified:
erp5/trunk/products/ERP5Type/patches/CookieCrumbler.py
Modified: erp5/trunk/products/ERP5Type/patches/CookieCrumbler.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Type/patches/CookieCrumbler.py?rev=23339&r1=23338&r2=23339&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Type/patches/CookieCrumbler.py (original)
+++ erp5/trunk/products/ERP5Type/patches/CookieCrumbler.py Tue Sep 2 13:40:13 2008
@@ -34,7 +34,7 @@
ATTEMPT_LOGIN = 1 # Attempt to log in
ATTEMPT_RESUME = 2 # Attempt to resume session
-from base64 import encodestring, decodestring
+from base64 import standard_b64encode, standard_b64decode
from DateTime import DateTime
class PatchedCookieCrumbler(CookieCrumbler):
@@ -99,8 +99,7 @@
attempt = ATTEMPT_LOGIN
name = req[self.name_cookie]
pw = req[self.pw_cookie]
- #ac = encodestring('%s:%s' % (name, pw)).rstrip() => changed for remove all newlines
- ac = encodestring('%s:%s' % (name, pw)).replace('\012','')
+ ac = standard_b64encode('%s:%s' % (name, pw))
self._setAuthHeader(ac, req, resp)
if req.get(self.persist_cookie, 0):
# Persist the user name (but not the pw or session)
@@ -124,7 +123,7 @@
ac = unquote(req[self.auth_cookie])
if ac and ac != 'deleted':
try:
- decodestring(ac)
+ standard_b64decode(ac)
except:
# Not a valid auth header.
pass
@@ -144,8 +143,7 @@
def credentialsChanged(self, user, name, pw):
- #ac = encodestring('%s:%s' % (name, pw)).rstrip() => changed for remove all newlines
- ac = encodestring('%s:%s' % (name, pw)).replace('\012','')
+ ac = standard_b64encode('%s:%s' % (name, pw))
method = self.getCookieMethod( 'setAuthCookie'
, self.defaultSetAuthCookie )
resp = self.REQUEST['RESPONSE']
More information about the Erp5-report
mailing list