summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2011-12-14 20:47:34 (GMT)
committerJohn (J5) Palmieri <johnp@redhat.com>2011-12-14 20:47:34 (GMT)
commit430db942ce921eaf7b3d0fb4b1a3158486f9d039 (patch)
tree6ca232270b0fac65cbeaf91dc8bedb31ac0a0859
parenta36190f91bab51ae1fd9621e96c0addc62a7ee7d (diff)
downloadfedoracommunity-430db942ce921eaf7b3d0fb4b1a3158486f9d039.zip
fedoracommunity-430db942ce921eaf7b3d0fb4b1a3158486f9d039.tar.gz
fedoracommunity-430db942ce921eaf7b3d0fb4b1a3158486f9d039.tar.xz
use tw2 middleware hack for only TurboGears < 2.1
* this fixes local testing
-rw-r--r--fedoracommunity/config/middleware.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/fedoracommunity/config/middleware.py b/fedoracommunity/config/middleware.py
index 0c121c0..f9c6a0d 100644
--- a/fedoracommunity/config/middleware.py
+++ b/fedoracommunity/config/middleware.py
@@ -17,13 +17,21 @@
from fedoracommunity.config.app_cfg import base_config
from fedoracommunity.config.environment import load_environment
+import tg
+tg_version_tuple = tuple(map(int, tg.__version__.split('.')))
+
make_base_app = base_config.setup_tg_wsgi_app(load_environment)
def make_app(global_conf, full_stack=True, **app_conf):
from moksha.middleware import make_moksha_middleware
+ make_middleware = make_moksha_middleware
+
+ if tg_version_tuple < (2, 1):
+ make_middleware = lambda app : make_moksha_middleware(base_config.add_tosca2_middleware(app))
+
app = make_base_app(global_conf,
- wrap_app=lambda app : make_moksha_middleware(base_config.add_tosca2_middleware(app)),
+ wrap_app=make_middleware,
full_stack=full_stack,
**app_conf)