fix example ui middleware
authorAlexander Solovyov <piranha@piranha.org.ua>
Thu, 03 Sep 2009 22:14:59 +0300
changeset 82 074c1768759a
parent 81 c93635699e2a
child 83 cf70fd773191
fix example ui middleware
test.py
--- a/test.py	Thu Sep 03 22:06:14 2009 +0300
+++ b/test.py	Thu Sep 03 22:14:59 2009 +0300
@@ -36,8 +36,6 @@
         sys.exit(opts['exit'])
 
 def ui_middleware(func):
-    if func.__name__ == 'help_inner':
-        return func
     def extract_dict(source, *keys):
         dest = {}
         for k in keys:
@@ -45,7 +43,10 @@
         return dest
 
     def inner(*args, **kwargs):
-        ui = UI(**extract_dict(kwargs, 'verbose', 'quiet'))
+        opts = extract_dict(kwargs, 'verbose', 'quiet')
+        if func.__name__ == 'help_inner':
+            return func(*args, **kwargs)
+        ui = UI(**opts)
         return func(ui, *args, **kwargs)
     return inner