This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author demian.brecht
Recipients berker.peksag, demian.brecht, flox, loewis, mcjeff, polymorphm
Date 2014-12-15.16:55:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1418662523.24.0.235600638158.issue14134@psf.upfronthosting.co.za>
In-reply-to
Content
+ loewis as he's listed as the xmlrpc expert

If you're worried about the number of lines, turn the function into a lambda:

    proxy = ServerProxy('http://example.com/gateway/', transport=Transport(
        connection_factory=lambda h: HTTPConnection(h, timeout=42)))

I think that the problem with the way that you're looking at the problem:'just only for adding "timeout"', when what you're fundamentally after is to modify the attribute of an object two levels removed by composition.

I /do/ agree that this is slightly more complex than simply setting a timeout parameter, but I also think that it's actually quite a bit more flexible and practically useful.

Borrowing from PEP20: "There should be one-- and preferably only one --obvious way to do it.". Having a timeout at the top level ServerProxy object introduces ambiguity and therefore doesn't conform. Should the connection_factory concept be used, having a timeout parameter at the Transport level also introduces ambiguity. Setting the timeout through a custom HTTPConnection instantiated through connection_factory is an obvious way to do it (especially if documented) and is marginally more code.

If you /only/ care about the timeout and really don't want to be bothered with the connection_factory, you can always set the global socket timeout for the given request with:

    socket.setdefaulttimeout([timeout])
History
Date User Action Args
2014-12-15 16:55:23demian.brechtsetrecipients: + demian.brecht, loewis, flox, mcjeff, polymorphm, berker.peksag
2014-12-15 16:55:23demian.brechtsetmessageid: <1418662523.24.0.235600638158.issue14134@psf.upfronthosting.co.za>
2014-12-15 16:55:23demian.brechtlinkissue14134 messages
2014-12-15 16:55:22demian.brechtcreate