[Freeipa-devel] [PATCH] Invalid method: __nonzero__ from xmlrpc server
Kevin McCarthy
kmccarth at redhat.com
Thu Aug 2 21:17:50 UTC 2007
Kevin McCarthy wrote:
> 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:
> 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).
# HG changeset patch
# User kmccarth at redhat.com
# Date 1186089340 25200
# Node ID 976cae2e4f76528be7f73a05383c519b374bb4a1
# Parent 6e4eb9605ab04e11e41ff763107969e53fc8a388
Change server to not be global nor reused.
diff -r 6e4eb9605ab0 -r 976cae2e4f76 ipa-python/rpcclient.py
--- a/ipa-python/rpcclient.py Wed Aug 01 16:26:04 2007 -0400
+++ b/ipa-python/rpcclient.py Thu Aug 02 14:15:40 2007 -0700
@@ -34,17 +34,12 @@ def server_url():
def server_url():
return "http://" + config.config.get_server() + "/ipa"
-# FIXME: do we want this set somewhere else?
-server = None
-
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"""
- setup_server()
+ server = setup_server()
try:
result = server.get_user(username)
myuser = result
@@ -59,7 +54,7 @@ def get_user(username):
def add_user(user):
"""Add a new user"""
- setup_server()
+ server = setup_server()
# FIXME: Get the realm from somewhere
realm = config.config.get_realm()
@@ -95,7 +90,7 @@ def get_add_schema():
"""Get the list of attributes we need to ask when adding a new
user.
"""
- setup_server()
+ server = setup_server()
# FIXME: Hardcoded and designed for the TurboGears GUI. Do we want
# this for the CLI as well?
-------------- 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/72b31077/attachment.bin>
More information about the Freeipa-devel
mailing list