Author: tmckay
Date: 2012-02-10 18:52:28 +0000 (Fri, 10 Feb 2012)
New Revision: 5216
Modified:
trunk/cumin/python/cumin/widgets.py
trunk/wooly/python/wooly/__init__.py
trunk/wooly/python/wooly/server.py
Log:
Exception handling for redirect must be compatible with Python 2.4
Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py 2012-02-10 17:50:38 UTC (rev 5215)
+++ trunk/cumin/python/cumin/widgets.py 2012-02-10 18:52:28 UTC (rev 5216)
@@ -1328,12 +1328,13 @@
return False
- def redirect_on_exception(self, session, e):
+ def redirect_on_exception(self, session):
# If we have an exception from a missing object, redirect to the
# main page with a notice instead of using the not_found_tmpl below.
# Test for presence on the index.html page already to avoid any possibility
# of an infinite redirect loop.
- if type(e) is RosemaryNotFound and \
+ cls, value, traceback = sys.exc_info()
+ if cls is RosemaryNotFound and \
session.request_environment["REQUEST_URI"] !=
"/index.html":
session.add_notice(Notice("An object being displayed became
unavailable"))
Modified: trunk/wooly/python/wooly/__init__.py
===================================================================
--- trunk/wooly/python/wooly/__init__.py 2012-02-10 17:50:38 UTC (rev 5215)
+++ trunk/wooly/python/wooly/__init__.py 2012-02-10 18:52:28 UTC (rev 5216)
@@ -482,7 +482,7 @@
return self.render(session)
- def redirect_on_exception(self, session, e):
+ def redirect_on_exception(self, session):
return None
def service_error(self, session):
Modified: trunk/wooly/python/wooly/server.py
===================================================================
--- trunk/wooly/python/wooly/server.py 2012-02-10 17:50:38 UTC (rev 5215)
+++ trunk/wooly/python/wooly/server.py 2012-02-10 18:52:28 UTC (rev 5216)
@@ -126,14 +126,14 @@
except PageRedirect:
status = "303 See Other"
headers.append(("Location", page.redirect.get(session)))
- except UpdateRedirect as e:
+ except UpdateRedirect, e:
# This will optionally allow a failed ajax update to
# process a location change. Javascript code in the
# update handler will look for the header.
status = "200 OK"
headers.append(("Location", e.url))
- except Exception as e:
- url = page.redirect_on_exception(session, e)
+ except:
+ url = page.redirect_on_exception(session)
if url:
status = "303 See Other"
headers.append(("Location", url))
Show replies by date