1
0
Fork 0
gnuviechadmin-historic/backend/xmlrpcserver.py

31 lines
853 B
Python
Raw Normal View History

#!/usr/bin/python
"""
XML-RPC server for gnuviech-admin tool
(c) 2006 Jan Dittberner
$Id$
"""
from DocXMLRPCServer import DocXMLRPCServer
from GnuviechAdmin import ServiceFacade, Settings
import logging, threading
logger = logging.getLogger()
hdlr = logging.FileHandler('xmlrpcserver.log')
f = logging.Formatter('%(asctime)s %(levelname)s %(module)s: %(message)s')
hdlr.setFormatter(f)
logger.addHandler(hdlr)
logger.setLevel(logging.DEBUG)
server = DocXMLRPCServer(Settings.RPCSERVERADDRESS)
server.register_introspection_functions()
server.register_instance(ServiceFacade())
try:
server.serve_forever()
except KeyboardInterrupt:
server.server_close()
for thread in [t for t in threading.enumerate() if t.isAlive() \
and isinstance(t, threading._Timer)]:
logger.debug("Stopping timer thread %s" % thread.getName())
thread.cancel()