[Freeipa-devel] Invalid method: __nonzero__ from xmlrpc server

Kevin McCarthy kmccarth at redhat.com
Thu Aug 2 20:56:28 UTC 2007


Kevin McCarthy wrote:
> I've finally gotten TurboGears templates and such working more to my
> liking, so I've been playing with the get_user() RPC calls.  After
> calling get_user once or twice, the xmlrpc server starts returning
> 'Invalid method: __nonzero__' responses.

After following Rob's advice, I've found the problem is with the client
side.  If you send two get_user() requests, the second one sends a
garbage request to the server:

<?xml version='1.0'?>
<methodCall>
<methodName>__nonzero__</methodName>
<params>
</params>
</methodCall>

It looks like this is because we're reusing the same
xmlrpclib.ServerProxy over and over.  I'm guessing you need to use a new
one for each connection.

When I change the code to:

def setup_server():
    # global server
    # if not server:
    #     server = xmlrpclib.ServerProxy(server_url())
    return xmlrpclib.ServerProxy(server_url())

def get_user(username):
    """Get a specific user"""
    server = setup_server()
...

it works just fine.  Although the point is moot (since we're changing
the web gui) we probably didn't want to use a class variable anyway  (I
don't know if TurboGears is multi-threaded).

-Kevin

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 2228 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/freeipa-devel/attachments/20070802/649d2fda/attachment.bin>


More information about the Freeipa-devel mailing list