Ignore:
Timestamp:
29/09/09 15:42:02 (11 years ago)
Author:
pjkersha
Message:

Integrated automated start-up and shutdown of Paste http servers for unit tests.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI12-security/trunk/python/ndg_security_test/ndg/security/test/unit/wsgi/__init__.py

    r5774 r5779  
    2121    """Wrapper to paste.httpserver to enable background threading""" 
    2222     
    23     def __init__(self, cfgFilePath, port=7443, host='0.0.0.0'): 
     23    def __init__(self, app=None, cfgFilePath=None, port=7443, host='0.0.0.0'): 
    2424        """Load an application configuration from cfgFilePath ini file and  
    2525        instantiate Paste server object 
    2626        """        
    2727        self.__thread = None 
    28         fileConfig(cfgFilePath) 
    29         app = loadapp('config:%s' % cfgFilePath) 
     28         
     29        if cfgFilePath: 
     30            fileConfig(cfgFilePath) 
     31            app = loadapp('config:%s' % cfgFilePath) 
     32             
     33        elif app is None: 
     34            raise KeyError('Either the "cfgFilePath" or "app" keyword must be ' 
     35                           'set') 
     36             
    3037        self.__pasteServer = paste.httpserver.serve(app, host=host, port=port,  
    3138                                                    start_loop=False) 
Note: See TracChangeset for help on using the changeset viewer.