[z3-checkins] r34697 - z3/deliverance/trunk/deliverance

ianb at codespeak.net ianb at codespeak.net
Thu Nov 16 23:06:54 CET 2006


Author: ianb
Date: Thu Nov 16 23:06:52 2006
New Revision: 34697

Added:
   z3/deliverance/trunk/deliverance/exp_proxycommand.py   (contents, props changed)
Log:
Added frontend like deliverance-proxy, but using WSGIFilter.  Not quite ready to actually use it yet, though; hence putting it in its own module instead of replacing proxycommand and proxyapp

Added: z3/deliverance/trunk/deliverance/exp_proxycommand.py
==============================================================================
--- (empty file)
+++ z3/deliverance/trunk/deliverance/exp_proxycommand.py	Thu Nov 16 23:06:52 2006
@@ -0,0 +1,48 @@
+"""
+Experimental proxy command using WSGIFilter
+"""
+
+import sys
+import pkg_resources
+pkg_resources.require('WSGIFilter')
+from wsgifilter.proxycommand import *
+from deliverance.wsgimiddleware import DeliveranceMiddleware
+
+def make_middleware_factory(theme_uri, rule_uri, renderer='py'):
+    def make_middleware(app):
+        return DeliveranceMiddleware(
+            app, theme_uri=theme_uri, rule_uri=rule_uri,
+            renderer=renderer)
+    return make_middleware
+
+def main(args=None):
+    if args is None:
+        args = sys.argv[1:]
+    parser = make_basic_optparser(
+        'Deliverance')
+    parser.add_option(
+        '--theme',
+        help="The URI of the theme to use",
+        dest="theme_uri")
+    parser.add_option(
+        '--rule',
+        help="The URI of the ruleset to use",
+        dest="rule_uri")
+    parser.add_option(
+        '--renderer',
+        help="Select which renderer to use: 'py' or 'xslt'",
+        default='py')
+    options, args = parser.parse_args(args)
+    middleware = make_middleware_factory(
+        theme_uri=options.theme_uri,
+        rule_uri=options.rule_uri,
+        renderer=options.renderer)
+    run_proxy_command(
+        options, args, middleware, parser)
+    
+if __name__ == '__main__':
+    import pkg_resources
+    pkg_resources.require('Deliverance')
+    from deliverance.exp_proxycommand import main as exp_main
+    exp_main()
+    


More information about the z3-checkins mailing list