Index: twistd.py =================================================================== RCS file: /cvs/Twisted/twisted/scripts/twistd.py,v retrieving revision 1.38 diff -u -r1.38 twistd.py --- twistd.py 1 Mar 2003 04:03:28 -0000 1.38 +++ twistd.py 1 Mar 2003 04:06:12 -0000 @@ -1,4 +1,4 @@ -# Twisted, the Framework of Your Internet + # Copyright (C) 2001 Matthew W. Lefkowitz # # This library is free software; you can redistribute it and/or @@ -439,6 +439,7 @@ log.msg("Failed to unlink PID file:") log.deferr() log.msg("Server Shut Down.") + report(application) def run(): @@ -455,3 +456,32 @@ os._exit(1) runApp(config) + + +def rle(l): + import types + newl = [] + lastel = None + count = 0 + for elt in l: + if elt == lastel: + count = count + 1 + continue + elif lastel is not None: + if isinstance(lastel, types.ListType): + lastel = rle(lastel) + newl.append([lastel, count]) + lastel = elt + count = 1 + if isinstance(lastel, types.ListType): + lastel = rle(lastel) + newl.append([lastel, count]) + return newl + +def report(app): + email = 'your@email.address' + if hasattr(sys, 'getdxp') and app.processName: + import xmlrpclib + dxp = xmlrpclib.ServerProxy("http://manatee.mojam.com:7304") + dxp.add_dx_info(app.processName, email, sys.version_info[:3], rle(sys.getdxp())) + log.msg('Reported dxp results')