Changeset 6892
- Timestamp:
- 26/05/10 12:41:36 (11 years ago)
- Location:
- TI12-security/trunk/MyProxyServerUtils/myproxy/server/test
- Files:
-
- 6 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TI12-security/trunk/MyProxyServerUtils/myproxy/server/test/__init__.py
r6881 r6892 1 """MyProxy Server Utilities unit test package 2 """ 3 __author__ = "P J Kershaw" 4 __date__ = "25/05/10" 5 __copyright__ = "(C) 2010 Science and Technology Facilities Council" 6 __license__ = "BSD - see LICENSE file in top-level directory" 7 __contact__ = "Philip.Kershaw@stfc.ac.uk" 8 __revision__ = '$Id$' 9 import logging 10 logging.basicConfig(level=logging.DEBUG) 11 12 import paste.httpserver 13 from threading import Thread 14 from paste.deploy import loadapp 15 from paste.script.util.logging_config import fileConfig 16 17 18 class PasteDeployAppServer(object): 19 """Wrapper to paste.httpserver to enable background threading""" 20 21 def __init__(self, app=None, cfgFilePath=None, port=7443, host='0.0.0.0', 22 ssl_context=None): 23 """Load an application configuration from cfgFilePath ini file and 24 instantiate Paste server object 25 """ 26 self.__thread = None 27 28 if cfgFilePath: 29 fileConfig(cfgFilePath) 30 app = loadapp('config:%s' % cfgFilePath) 31 32 elif app is None: 33 raise KeyError('Either the "cfgFilePath" or "app" keyword must be ' 34 'set') 35 36 self.__pasteServer = paste.httpserver.serve(app, host=host, port=port, 37 start_loop=False, 38 ssl_context=ssl_context) 39 40 @property 41 def pasteServer(self): 42 return self.__pasteServer 43 44 @property 45 def thread(self): 46 return self.__thread 47 48 def start(self): 49 """Start server""" 50 self.pasteServer.serve_forever() 51 52 def startThread(self): 53 """Start server in a separate thread""" 54 self.__thread = Thread(target=PasteDeployAppServer.start, args=(self,)) 55 self.thread.start() 56 57 def terminateThread(self): 58 self.pasteServer.server_close() -
TI12-security/trunk/MyProxyServerUtils/myproxy/server/test/test_myproxywsgi.py
r6888 r6892 7 7 __license__ = "BSD - see LICENSE file in top-level directory" 8 8 __contact__ = "Philip.Kershaw@stfc.ac.uk" 9 __revision__ = '$Id :$'9 __revision__ = '$Id$' 10 10 import logging 11 11 logging.basicConfig(level=logging.DEBUG)
Note: See TracChangeset
for help on using the changeset viewer.