[Twisted-Python] usage.Options

Kevin Turner acapnotic at twistedmatrix.com
Sat Oct 5 05:31:37 MDT 2002


On Sat, 2002-10-05 at 00:18, Brian Warner wrote:
> One shortcoming of my patch is that the auth will probably steal pb.portno
> from any existing PB services. If there are already PB services listening on
> that port, the code should probably raise an exception and tell the user to
> make it listen on a different one (rather than silently insert it's user/pass
> into the user's Authorizer). I don't know how to check for that.. any ideas?

I had code very much like this in mktap once, to allow building in a
manhole to any .tap upon creation.  It did some check so that if a PB
server was already running, it would go ahead and add the manhole
service to that instead of trying to open a port.  Adding a user/pass to
the existing authorizer (which it did) may not be such a bad idea as you
seem to suggest, since you only give that new identity a key for the
"twisted.manhole" service and not the other(s).   (...but authorizers
are now per-Service, not per-ServiceCollection, so you can still have
your separate one if you wish, even if you put them on one port under
the same broker factory.)

However, that code was blown away sometime when I wasn't looking and I
was later urged to use "mktap --append foo.tap manhole" instead, which
still has the same port-clobbering problem as you ran in to.

Back to the question that started this thread, I do agree with you that
adding an "addManhole" interface is a much more reasonable thing to do
than changing the usage.Options interface.  I understand what you said
about the "from twisted.tap.manhole import Options, updateapplication"
being a quick and convenient solution, but it should be recognized that
it's a somewhat abusive hack.  Modules in the 'tap' package are for use
with mktap, and "usage" is a command-line processing utility, not a more
comprehensive configuration tool such as coil might be.

I hope that didn't sound unforgivably grouchy -- I'm up past my bedtime
and am due for a nap.

g'night,

 - kevin

-- 
The moon is waning crescent, 2.6% illuminated, 28.0 days old.






More information about the Twisted-Python mailing list