[Twisted-Python] twisted.web and MySQLdb

Moshe Zadka m at zadka.site.co.il
Wed Oct 29 01:46:27 EST 2003


On Tue, 28 Oct 2003, Donovan Preston <dp at twistedmatrix.com> wrote:

> The "I wonder what parameters were used" idea is pretty interesting, 
> though. It would be trivial to serialize the command-line options that 
> were given to each invocation of mktap along with everything else so at 
> the very least we could show you which command line options were used 
> to build the application in the first place.

Well, you'd have to consider what to do about mktap --append.
Assuming you just want a "history of command line", it would be
a 10-minute hack to mktap, which is based on a service:

class MktapArgs(service.Service):
    def __init__(self):
        self.setName("mktap")
        self.history = []
    def run(self):
        self.history.append(sys.argv)

def document(application):
    try:
        s = service.IServiceCollection(application).getServiceByName("mktap")
    except KeyError
        s = MktapArgs()
        s.setServiceParent(application)
    s.run()

And just add a call to document(application) in twisted/scripts/mktap.py, five
lines into addToApplication.




More information about the Twisted-Python mailing list