[Mpuls-commits] r1614 - wasko/branches/2.0/mpulsweb/config

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Tue Feb 16 12:47:32 CET 2010


Author: torsten
Date: 2010-02-16 12:47:32 +0100 (Tue, 16 Feb 2010)
New Revision: 1614

Modified:
   wasko/branches/2.0/mpulsweb/config/environment.py
   wasko/branches/2.0/mpulsweb/config/middleware.py
Log:
* mpulsweb/config/environment.py,
  mpulsweb/config/middleware.py: Enable cascaded loading of static
  files.


Modified: wasko/branches/2.0/mpulsweb/config/environment.py
===================================================================
--- wasko/branches/2.0/mpulsweb/config/environment.py	2010-02-16 11:42:53 UTC (rev 1613)
+++ wasko/branches/2.0/mpulsweb/config/environment.py	2010-02-16 11:47:32 UTC (rev 1614)
@@ -50,10 +50,12 @@
     template_urls.append(os.path.join(root, 'templates'))
 
     # Static content (images, styles, formed...)
-    static_url = os.path.join(root, 'public')
-    if global_conf.get('mpuls.app.path.public'):
-        static_url = global_conf.get('mpuls.app.path.public')
-        log.info('Custom "public" directory: %s' % static_url)
+    static_urls = [] 
+    custom_static = global_conf.get('mpuls.app.path.public')
+    if custom_static:
+        log.info('Custom "public" directory: %s' % custom_static)
+        static_urls.append(global_conf.get('mpuls.app.path.public'))
+    static_urls.append(os.path.join(root, 'public'))
 
     # Controllers 
     controller_url = os.path.join(root, 'controllers')
@@ -63,7 +65,7 @@
 
     paths = dict(root=root,
                  controllers=controller_url,
-                 static_files=static_url,
+                 static_files=static_urls,
                  templates=template_urls)
 
     # Initialize config with the basic options

Modified: wasko/branches/2.0/mpulsweb/config/middleware.py
===================================================================
--- wasko/branches/2.0/mpulsweb/config/middleware.py	2010-02-16 11:42:53 UTC (rev 1613)
+++ wasko/branches/2.0/mpulsweb/config/middleware.py	2010-02-16 11:47:32 UTC (rev 1614)
@@ -120,7 +120,8 @@
 
     if asbool(static_files):
         # Serve static files
-        static_app = StaticURLParser(config['pylons.paths']['static_files'])
-        app = Cascade([static_app, app])
+        static_apps = [StaticURLParser(path) 
+            for path in config['pylons.paths']['static_files']]
+        app = Cascade(static_apps + [app])
 
     return app



More information about the Mpuls-commits mailing list