complicated class question

Fred Clift fclift at verio.net
Fri Nov 8 17:17:53 EST 2002


On Fri, 8 Nov 2002, Alex Martelli wrote:
...
> then attribute named 'a' is looked up in global variable 'syslib'
> of this module, and then called, each time method bar is called
> on an instance of b.  If the module uses "from syslib import a"
> instead, then the lookup is done when the "from" statement
> executes.  In either case, it's possible to change an attribute
> of this 'thirdparty' module after the class statement is
> executed (and even after class b is instantiated) and before
> method bar is called on b instances, and affect what ends up
> in ainst -- but without knowing whether module 'thirdparty' uses
> statement import or statement from, we can't know whether we
> need to rebind thirdparty.syslib or else thirdparty.a.
>


Ok -- I've posted the toy version of this problem without enough detail so
let me tell you the gory details.

I'm writing a SOAP client using ZSI.  I create an
instance of ZSI.client.Binding().  ZSI/client.py does an import httplib,
and creates an instance of httplib.HTTPConnection().  I'm trying to
provide customized a customized httplib.HTTPConnection.Connect().  My
version would do a normal connect and then negotiate a custom security
exchange ahead of the normal transaction (gssapi/kerberos encryption of
the connection).

So, I want my program to be able to either a) change my namesapce ahead of
time, or fiddle with the namespace of an instance of ZSI.client.Binding()
so that when it does an 'import httplib' and makes an instance of
httplib.HTTPConnection that it gets my version of of that class, or at the
least, I can hook the Connect function somehow.

A cursory examination of the code appears to show that I can insantiate
Binding without it making any connections or doing much till I make my
first soap calls.  If this is the case, I could settle for
after-instantiation poking around in the object.

I've been away from my email for several hours and have not yet had a
chance to try out the suggestions of the people on this list.  That is
next on my list to do so I'll let you know if any of the suggestions work.

Again, thaks for your patience and your suggestions. :).

Fred


--
Fred Clift - fclift at verio.net -- Remember: If brute
force doesn't work, you're just not using enough.





More information about the Python-list mailing list