summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-09-30 00:48:53 -0400
committerJason Gerard DeRose <jderose@redhat.com>2008-09-30 19:37:35 -0600
commit77e6c99f9d8e34e85add7671d89bf7698a4fe5c2 (patch)
tree2093d7b2ecbffe747368c43981fdd354a23db00a
parentb965e558b5def14c6416beb36dc790cca96c3724 (diff)
downloadfreeipa-77e6c99f9d8e34e85add7671d89bf7698a4fe5c2.tar.gz
freeipa-77e6c99f9d8e34e85add7671d89bf7698a4fe5c2.tar.xz
freeipa-77e6c99f9d8e34e85add7671d89bf7698a4fe5c2.zip
Migrate to new source tree layoute
-rw-r--r--ipa_server/conn.py5
-rw-r--r--ipa_server/context.py29
-rw-r--r--ipa_server/servercore.py4
-rwxr-xr-xipa_server/test_client (renamed from server/test_client)17
-rwxr-xr-xipa_server/test_server (renamed from server/test_server)10
-rw-r--r--ipalib/plugins/example.py3
6 files changed, 50 insertions, 18 deletions
diff --git a/ipa_server/conn.py b/ipa_server/conn.py
index f8f5306fa..fb00ad998 100644
--- a/ipa_server/conn.py
+++ b/ipa_server/conn.py
@@ -18,12 +18,9 @@
#
import krbV
-import threading
import ldap
import ldap.dn
-from ipalib import ipaldap
-
-context = threading.local()
+import ipaldap
class IPAConn:
def __init__(self, host, port, krbccache, debug=None):
diff --git a/ipa_server/context.py b/ipa_server/context.py
new file mode 100644
index 000000000..e20587cc6
--- /dev/null
+++ b/ipa_server/context.py
@@ -0,0 +1,29 @@
+# Authors: Rob Crittenden <rcritten@redhat.com>
+#
+# Copyright (C) 2008 Red Hat
+# see file 'COPYING' for use and warranty information
+#
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; version 2 only
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+# This should only be imported once. Importing again will cause the
+# a new instance to be created in the same thread
+
+# To use:
+# from ipa_server.context import context
+# context.foo = "bar"
+
+import threading
+
+context = threading.local()
diff --git a/ipa_server/servercore.py b/ipa_server/servercore.py
index 8626c04bf..eeecd4b03 100644
--- a/ipa_server/servercore.py
+++ b/ipa_server/servercore.py
@@ -21,8 +21,8 @@ import sys
sys.path.insert(0, ".")
sys.path.insert(0, "..")
import ldap
-from ipalib.conn import context
-from ipalib import ipautil
+from ipa_server.context import context
+import ipautil
# temporary
import krbV
diff --git a/server/test_client b/ipa_server/test_client
index 79945a96b..364fd3b81 100755
--- a/server/test_client
+++ b/ipa_server/test_client
@@ -1,7 +1,16 @@
#!/usr/bin/python
import xmlrpclib
+
+def user_find(uid):
+ try:
+ args=uid
+ result = server.user_find(args)
+ print "returned %s" % result
+ except xmlrpclib.Fault, e:
+ print e.faultString
+# main
server = xmlrpclib.ServerProxy("http://localhost:8888/")
print server.system.listMethods()
@@ -15,9 +24,5 @@ try:
except xmlrpclib.Fault, e:
print e.faultString
-try:
- args="admin"
- result = server.user_find(args)
- print "returned %s" % result
-except xmlrpclib.Fault, e:
- print e.faultString
+user_find("admin")
+user_find("notfound")
diff --git a/server/test_server b/ipa_server/test_server
index 2af833995..a67263699 100755
--- a/server/test_server
+++ b/ipa_server/test_server
@@ -9,8 +9,9 @@ import xmlrpclib
import re
import threading
import commands
-from ipalib import api, conn
-from ipalib.conn import context
+from ipalib import api
+import conn
+from ipa_server.servercore import context
import ipalib.load_plugins
import traceback
@@ -66,8 +67,9 @@ class LoggingSimpleXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHa
return func(*params)
finally:
# Clean up any per-request data and connections
- for k in context.__dict__.keys():
- del context.__dict__[k]
+# for k in context.__dict__.keys():
+# del context.__dict__[k]
+ pass
def _marshaled_dispatch(self, data, dispatch_method = None):
try:
diff --git a/ipalib/plugins/example.py b/ipalib/plugins/example.py
index c7d161600..6113c1174 100644
--- a/ipalib/plugins/example.py
+++ b/ipalib/plugins/example.py
@@ -21,12 +21,11 @@
Some example plugins.
"""
-
from ipalib import frontend
from ipalib import crud
from ipalib.frontend import Param
from ipalib import api
-from ipalib import servercore
+from ipa_server import servercore
import ldap
class user(frontend.Object):