[Zope3-checkins]
SVN: Zope3/trunk/src/zope/app/pas/browserplugins.py
Changed to use an id (dotted name) for the session key.
Jim Fulton
jim at zope.com
Sat Oct 30 18:51:31 EDT 2004
Log message for revision 28303:
Changed to use an id (dotted name) for the session key.
Did a little doctest formatting.
Changed:
U Zope3/trunk/src/zope/app/pas/browserplugins.py
-=-
Modified: Zope3/trunk/src/zope/app/pas/browserplugins.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/browserplugins.py 2004-10-30 22:51:24 UTC (rev 28302)
+++ Zope3/trunk/src/zope/app/pas/browserplugins.py 2004-10-30 22:51:31 UTC (rev 28303)
@@ -69,7 +69,6 @@
def __str__(self): return self.getLogin() + ':' + self.getPassword()
-
class SessionExtractor(Persistent, Contained):
""" session-based credential extractor.
@@ -83,8 +82,8 @@
>>> sessionSetUp(RAMSessionDataContainer)
>>> se = SessionExtractor()
+ Start: No credentials available
- Start: No credentials available
>>> request = TestRequest()
>>> se.extractCredentials(request) is None
True
@@ -93,6 +92,7 @@
If the session does not contain the credentials check
the request for form variables and store the credentials in
the session.
+
>>> request = TestRequest(login='scott', password='tiger')
>>> se.extractCredentials(request)
{'login': 'scott', 'password': 'tiger'}
@@ -100,11 +100,13 @@
After login the credentials are stored in the session.
(The tests.sessionSetUp() method ensures that in this test the request
always gets the same client id so we get the same session data.)
+
>>> request = TestRequest()
>>> se.extractCredentials(request)
{'login': 'scott', 'password': 'tiger'}
We must be able to re-login with another username and password:
+
>>> request = TestRequest(login='harry', password='hirsch')
>>> se.extractCredentials(request)
{'login': 'harry', 'password': 'hirsch'}
@@ -114,11 +116,10 @@
Magic logout command in URL forces log out by deleting the
credentials from the session.
+
>>> request = TestRequest(authrequest='logout')
- >>> se.extractCredentials(request) is None
- True
- >>> Session(request)['pas']['credentials'] is None
- True
+ >>> se.extractCredentials(request)
+ >>> Session(request)['zope.app.pas.browserplugins']['credentials']
"""
implements(IExtractionPlugin)
@@ -126,7 +127,7 @@
""" return credentials from session, request or None """
#if not credentials:
# check for form data
- sessionData = ISession(request)['pas']
+ sessionData = ISession(request)['zope.app.pas.browserplugins']
login = request.get('login', None)
password = request.get('password', None)
if login and password:
More information about the Zope3-Checkins
mailing list