[Twisted-Python] question about twisted+wxPython : How to migrate to twistd ?

bino oetomo bino at indoakses-online.com
Mon Jan 9 00:39:00 EST 2012


Dear All ...

I just copy and paste the code from 
http://code.activestate.com/recipes/298985/
and adding lines :
--------------
         self.allowNone = True
         self.useDateTime = False
--------------
just before line#  45,
and it work great.

I need to adopting that script to my application, but I'm not familiar 
with code line 64-78 :
--------------------
if __name__ == '__main__':

     # Initiliaze MyApp
     app = MyXMLRPCApp(False) # False -> printing stdout/stderr to shell,
                              # not in an additional wx window

     # Make wx application twisted aware
     # Must have to start "wxreactor.install()" on top before
     reactor.registerWxApp(app)

     # Make a XML-RPC Server listening to port 7080
     reactor.listenTCP(7080, server.Site(app))
-------------------

How to migrate that script to twistd, something like :
------------------
#Create Application
application = service.Application("MultiService Example")
#Create xmlrpc site
myrpc = MyRPC()
site = server.Site(myrpc)
myrpcservice = internet.TCPServer(50008, site, interface='localhost')
#Creating Multi Service
multiService = service.MultiService()
#Add our Services to multiservice
myrpcservice.setServiceParent(multiService)
#Set created application to be serviceparent of multiservice
multiService.setServiceParent(application)
------------------

Kindly please give me your enlightment.

Sincerely
-bino-




More information about the Twisted-Python mailing list