Changeset 163

Show
Ignore:
Timestamp:
11/08/08 21:18:27
Author:
thejimmyg
Message:

Adding iterator support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • AuthKit/trunk/CHANGELOG.txt

    r162 r163  
    440.4.3 
    55 
     6* The multi handler now handles WSGI applications implemented as iterators, 
     7  it already supported generators. The multi2.py example demonstrates this. 
    68* Set the pylons.status_code_redirect environment variable on all redirected  
    79  AuthKit responses 
  • AuthKit/trunk/authkit/authenticate/multi.py

    r162 r163  
    8686         
    8787        app_iter = app(environ, start_response) 
    88         if not result_: 
    89             raise Exception('Invalid WSGI response, did the application return an iterable?') 
    90         if result_[-1] is None: 
    91             # The check failed and the initial app should be used. 
    92             return app_iter 
    93         else: 
    94             # Close the unused app which we don't want 
    95             if hasattr(app_iter, 'close'): 
    96                 app_iter.close() 
    97             return result_[-1] 
     88        # if not result_: 
     89        #     raise Exception('Invalid WSGI response (%r), did the application return an iterable?'%result_) 
     90        # if result_[-1] is None: 
     91        #     # The check failed and the initial app should be used. 
     92        #     return app_iter 
     93        # else: 
     94        #     # Close the unused app which we don't want 
     95        #     if hasattr(app_iter, 'close'): 
     96        #         app_iter.close() 
     97        #     return result_[-1] 
     98        for data in app_iter: 
     99            yield data 
     100        if hasattr(app_iter, 'close'): 
     101            app_iter.close() 
     102        #return result_[-1] 
    98103 
    99104def status_checker(environ, status, headers):