#!/usr/bin/env python2.4 class Service: def echo(self, msg): return msg from jsonrpc.cgihandler import handleCGIRequest handleCGIRequest(Service())
#!/usr/bin/env python class Service: def echo(self, msg): return msg def reverse(self, msg): return msg[::-1] def uppercase(self, msg): return msg.upper() def lowercase(self, msg): return msg.lower() if __name__ == '__main__': # this is if JSONService.py is run as a CGI from jsonrpc.cgihandler import handleCGIRequest handleCGIRequest(Service()) else: # this is if JSONService.py is run from mod_python: # rename .htaccess.mod_python to .htaccess to activate, # and restart Apache2 from jsonrpc.apacheServiceHandler import handler
import logging import os import sys if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', datefmt='%m-%d %H:%M', filename='JSONRPCRerouterService.log', filemode='a') #Path one above the taoggregator root tao_path_up_one = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..')) sys.path.append(tao_path_up_one) import taoggregator from taoggregator.clientimpls import SocketClient from jsonrpc.cgihandler import handleCGIRequest handleCGIRequest(SocketClient(taoggregator.createConnStr(*taoggregator.getDefaultHostAndPort())))