[Twisted-Python] Bug in Finger Tutorial?

Dorian Raymer deldotdr at gmail.com
Thu Sep 29 17:28:50 EDT 2011


I am confused about how the FingerService gets started in the
finger/finger.py makeService function. It is never assigned a service parent
and it can't service getUser requests if its startService method isn't
called; you get an AttributeError: "no attribute 'users'" the way it works
now. Is this a bug?

The most sensible thing, in this case, seems to be setting the
FingerServiceparent to be the
MultiService container that all of the interent services are added to in the
makeService function. Is that correct?

I'm wondering if their are any other strategies people use for starting
non-internet services.
For instance, if instead of reading a file to get to my user db, I might
want to start a redis client and read from redis to service a getUser call.
But that means I'd want to make sure the startService call succeeded (the
redis connection was made) before one of the internet services tries to use
the FingerService (a timing problem that doesn't exist when just reading a
file)...or something. Maybe I'm really just wondering how the twisted
application framework handles exceptions that occur for startService calls.
Maybe I need something else to handle that kind of thing?

I'm also wondering if it's ever a good idea to make a extension of
ServerFactory (that adapts a Service) that calls Service.startService
when Factory.startServer
is called (and Service.stopService when Factory.stopFactory is called)?

And I'm looking for more use cases/projects (beyond the finger tutorial)
that really showcase the twisted application framework. Any references would
be appreciated!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20110929/695dc7a3/attachment.htm 

More information about the Twisted-Python mailing list