[Checkins] SVN: zope.app.authentication/trunk/ Note the fix for python 2.6.

Dan Korostelev nadako at gmail.com
Thu Mar 12 10:55:35 EDT 2009


Log message for revision 97987:
  Note the fix for python 2.6.
  Move login form class from "session" to "loginform" module.
  Use developed components to ensure right versions in the buildout.cfg

Changed:
  U   zope.app.authentication/trunk/CHANGES.txt
  U   zope.app.authentication/trunk/buildout.cfg
  A   zope.app.authentication/trunk/src/zope/app/authentication/browser/loginform.py
  D   zope.app.authentication/trunk/src/zope/app/authentication/browser/session.py
  U   zope.app.authentication/trunk/src/zope/app/authentication/browser/session.zcml

-=-
Modified: zope.app.authentication/trunk/CHANGES.txt
===================================================================
--- zope.app.authentication/trunk/CHANGES.txt	2009-03-12 13:47:03 UTC (rev 97986)
+++ zope.app.authentication/trunk/CHANGES.txt	2009-03-12 14:55:34 UTC (rev 97987)
@@ -9,6 +9,8 @@
   ``loginForm.html`` view. Now the logic is contained in the
   ``zope.app.authentication.browser.session.LoginForm`` class.
 
+* Fix login form redirection failure in some cases with Python 2.6.
+
 * Use the new ``zope.authentication`` package instead of ``zope.app.security``. 
 
 * The "Password Manager Names" vocabulary and simple password manager registry

Modified: zope.app.authentication/trunk/buildout.cfg
===================================================================
--- zope.app.authentication/trunk/buildout.cfg	2009-03-12 13:47:03 UTC (rev 97986)
+++ zope.app.authentication/trunk/buildout.cfg	2009-03-12 14:55:34 UTC (rev 97987)
@@ -5,6 +5,10 @@
   ../zope.component
   ../zope.container
   ../zope.password
+  ../zope.principalregistry
+  ../zope.localpermission
+  ../zope.security
+  ../zope.app.security
   ../zope.app.component
   ../zope.app.container
   ../zope.app.form

Copied: zope.app.authentication/trunk/src/zope/app/authentication/browser/loginform.py (from rev 97982, zope.app.authentication/trunk/src/zope/app/authentication/browser/session.py)
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/browser/loginform.py	                        (rev 0)
+++ zope.app.authentication/trunk/src/zope/app/authentication/browser/loginform.py	2009-03-12 14:55:34 UTC (rev 97987)
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2009 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Login Form
+
+$Id$
+"""
+from zope.authentication.interfaces import IUnauthenticatedPrincipal
+
+class LoginForm(object):
+    """Mix-in class to implement login form logic"""
+    
+    def __call__(self):
+        request = self.request
+        principal = request.principal
+
+        unauthenticated = IUnauthenticatedPrincipal.providedBy(principal)
+        self.unauthenticated = unauthenticated
+        
+        camefrom = request.get('camefrom')
+        if isinstance(camefrom, list):
+            # this can happen on python2.6, as it changed the
+            # behaviour of cgi.FieldStorage a bit.
+            camefrom = camefrom[0]
+        self.camefrom = camefrom
+        
+        if (not unauthenticated) and ('SUBMIT' in request):
+            # authenticated by submitting
+            request.response.redirect(camefrom or '.')
+            return ''
+        
+        return self.index() # call template

Deleted: zope.app.authentication/trunk/src/zope/app/authentication/browser/session.py
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/browser/session.py	2009-03-12 13:47:03 UTC (rev 97986)
+++ zope.app.authentication/trunk/src/zope/app/authentication/browser/session.py	2009-03-12 14:55:34 UTC (rev 97987)
@@ -1,42 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2009 Zope Foundation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-"""Login Form
-
-$Id$
-"""
-from zope.authentication.interfaces import IUnauthenticatedPrincipal
-
-class LoginForm(object):
-    """Mix-in class to implement login form logic"""
-    
-    def __call__(self):
-        request = self.request
-        principal = request.principal
-
-        unauthenticated = IUnauthenticatedPrincipal.providedBy(principal)
-        self.unauthenticated = unauthenticated
-        
-        camefrom = request.get('camefrom')
-        if isinstance(camefrom, list):
-            # this can happen on python2.6, as it changed the
-            # behaviour of cgi.FieldStorage a bit.
-            camefrom = camefrom[0]
-        self.camefrom = camefrom
-        
-        if ('SUBMIT' in request) and not unauthenticated:
-            # authenticated by submitting
-            request.response.redirect(camefrom or '.')
-            return ''
-        
-        return self.index() # call template

Modified: zope.app.authentication/trunk/src/zope/app/authentication/browser/session.zcml
===================================================================
--- zope.app.authentication/trunk/src/zope/app/authentication/browser/session.zcml	2009-03-12 13:47:03 UTC (rev 97986)
+++ zope.app.authentication/trunk/src/zope/app/authentication/browser/session.zcml	2009-03-12 14:55:34 UTC (rev 97987)
@@ -20,7 +20,7 @@
       name="loginForm.html" 
       for="*"
       template="loginform.pt"
-      class=".session.LoginForm"
+      class=".loginform.LoginForm"
       permission="zope.Public" 
       />
 



More information about the Checkins mailing list