[Checkins] SVN: Products.PluggableAuthService/branches/do3cc_defensive/Products/PluggableAuthService/plugins/CookieAuthHelper.py I was too clever in avoiding an IndexError

Patrick Gerken do3ccqrv at gmail.com
Wed Sep 1 05:51:50 EDT 2010


Log message for revision 116072:
  I was too clever in avoiding an IndexError
  

Changed:
  U   Products.PluggableAuthService/branches/do3cc_defensive/Products/PluggableAuthService/plugins/CookieAuthHelper.py

-=-
Modified: Products.PluggableAuthService/branches/do3cc_defensive/Products/PluggableAuthService/plugins/CookieAuthHelper.py
===================================================================
--- Products.PluggableAuthService/branches/do3cc_defensive/Products/PluggableAuthService/plugins/CookieAuthHelper.py	2010-09-01 09:37:32 UTC (rev 116071)
+++ Products.PluggableAuthService/branches/do3cc_defensive/Products/PluggableAuthService/plugins/CookieAuthHelper.py	2010-09-01 09:51:49 UTC (rev 116072)
@@ -189,6 +189,11 @@
         url = self.getLoginURL()
         if url is not None:
             came_from = req.get('came_from', None)
+            if isinstance(came_from, list):
+                try:
+                    came_from = came_from.pop()
+                except IndexError:
+                    came_from = None
 
             if came_from is None:
                 came_from = req.get('ACTUAL_URL', '')
@@ -210,8 +215,7 @@
                     # the only sane thing to do is to give up because we are
                     # in an endless redirect loop.
                     return 0
-            if isinstance(came_from, list):
-                came_from = came_from[:1]
+
             url = url + '?came_from=%s' % quote(came_from)
             resp.redirect(url, lock=1)
             return 1



More information about the checkins mailing list