[Mpuls-commits] r3081 - in base/trunk: . mpulsweb/config mpulsweb.egg-info

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Wed Jun 23 16:59:31 CEST 2010


Author: bh
Date: 2010-06-23 16:59:29 +0200 (Wed, 23 Jun 2010)
New Revision: 3081

Modified:
   base/trunk/ChangeLog
   base/trunk/mpulsweb.egg-info/entry_points.txt
   base/trunk/mpulsweb/config/middleware.py
Log:
* mpulsweb.egg-info/entry_points.txt: Add app_factory for
make_redirector

* mpulsweb/config/middleware.py (make_redirector): New.  Creates a
WSGI application that always responds with permanent redirects.
This is in Support of combined MPuls applications in JMD where
accessing / should redirect to one of two MPuls applications,
neither of which is mounted at /.


Modified: base/trunk/ChangeLog
===================================================================
--- base/trunk/ChangeLog	2010-06-23 13:23:49 UTC (rev 3080)
+++ base/trunk/ChangeLog	2010-06-23 14:59:29 UTC (rev 3081)
@@ -1,3 +1,14 @@
+2010-06-23  Bernhard Herzog  <bh at intevation.de>
+
+	* mpulsweb/config/middleware.py (make_redirector): New.  Creates a
+	WSGI application that always responds with permanent redirects.
+	This is in Support of combined MPuls applications in JMD where
+	accessing / should redirect to one of two MPuls applications,
+	neither of which is mounted at /.
+
+	* mpulsweb.egg-info/entry_points.txt: Add app_factory for
+	make_redirector
+
 2010-06-23  Torsten Irländer <torsten.irlaender at intevation.de>
 
 	* mpulsweb/controllers/case.py: Use translated strings in some dialogs

Modified: base/trunk/mpulsweb/config/middleware.py
===================================================================
--- base/trunk/mpulsweb/config/middleware.py	2010-06-23 13:23:49 UTC (rev 3080)
+++ base/trunk/mpulsweb/config/middleware.py	2010-06-23 14:59:29 UTC (rev 3081)
@@ -3,6 +3,7 @@
 import logging
 import locale
 
+from webob.exc import HTTPMovedPermanently
 from beaker.middleware import CacheMiddleware, SessionMiddleware
 from paste.cascade import Cascade
 from paste.registry import RegistryManager
@@ -147,3 +148,15 @@
         app = Cascade(static_apps + [app])
 
     return app
+
+
+def make_redirector(global_conf, **app_conf):
+    """Create a WSGI Application that permanently redirects to a specific URL.
+    The URL can be specified with the location setting in the configuration.
+
+    This is useful for e.g. a composite application with two WSGI
+    applications under different prefixes.  In this case one may want to
+    specify a default application to use when accessing the root URL of
+    the server.
+    """
+    return HTTPMovedPermanently(location=app_conf["location"])

Modified: base/trunk/mpulsweb.egg-info/entry_points.txt
===================================================================
--- base/trunk/mpulsweb.egg-info/entry_points.txt	2010-06-23 13:23:49 UTC (rev 3080)
+++ base/trunk/mpulsweb.egg-info/entry_points.txt	2010-06-23 14:59:29 UTC (rev 3081)
@@ -1,7 +1,7 @@
 
     [paste.app_factory]
     main = mpulsweb.config.middleware:make_app
+    redirector = mpulsweb.config.middleware:make_redirector
 
     [paste.app_install]
     main = pylons.util:PylonsInstaller
-    
\ No newline at end of file



More information about the Mpuls-commits mailing list