[Twisted-Python] how can I invoke an httpFactory method in http.request?

wang wei wgwigw at gmail.com
Sun Oct 1 03:01:28 EDT 2006


hi, is that a way to invoke a function in httpFactory from a http.request?
code here:
from twisted.web import http
class anotherRequestHandler(http.Request):
       def process(self):
             '''
             how to invoke a method in anotherHttpFactory
             such as judge?
             '''

class anotherHttp(http.HTTPChannel):
       requestFactory = anotherRequestHandler

class  resolve:
        def  show(self):
             return 'ok'

class anotherHttpFactory(http.HTTPFactory):
        def __init__(self):
             a = resolve()

        def judge(self):
             return a.show()


I don't want class 'resolve' to be initialized every time when a request
comes, or am I  mis-understand it ? Thanks for help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20061001/c842b037/attachment.htm 


More information about the Twisted-Python mailing list