[Freeipa-devel] [PATCH] add fields for larger data demo
Kevin McCarthy
kmccarth at redhat.com
Tue Aug 28 16:20:37 UTC 2007
This patch adds more fields to search results, for the new search demo.
It also moves the ldap result() call inside a try block - this seems to
throw an exception when size or admin limits are reached.
-Kevin
-------------- next part --------------
# HG changeset patch
# User Kevin McCarthy <kmccarth at redhat.com>
# Date 1188318012 25200
# Node ID 1516011064514df081512e527a82ab2850511fe0
# Parent fb7fbc0b4fa24a0686e00c5d6962c1189bfa1ee9
Changes for larger data demo.
Add fields to search results
Put result() call inside try block - it's throwing an exception
Trap ADMINLIMIT and SIZELIMIT exceptions
diff -r fb7fbc0b4fa2 -r 151601106451 ipa-server/ipa-gui/ipagui/controllers.py
--- a/ipa-server/ipa-gui/ipagui/controllers.py Mon Aug 27 12:52:26 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/controllers.py Tue Aug 28 09:20:12 2007 -0700
@@ -145,7 +145,7 @@ class Root(controllers.RootController):
try:
users = client.find_users(uid.encode('utf-8'))
except ipaerror.IPAError, e:
- turbogears.flash("User show failed: " + str(e))
+ turbogears.flash("User list failed: " + str(e))
raise turbogears.redirect("/userlist")
return dict(users=users, fields=forms.user.UserFields())
diff -r fb7fbc0b4fa2 -r 151601106451 ipa-server/ipa-gui/ipagui/templates/userlist.kid
--- a/ipa-server/ipa-gui/ipagui/templates/userlist.kid Mon Aug 27 12:52:26 2007 -0700
+++ b/ipa-server/ipa-gui/ipagui/templates/userlist.kid Tue Aug 28 09:20:12 2007 -0700
@@ -15,7 +15,7 @@
</div>
<div py:if='users != None'>
<h2>Results</h2>
- <table py:if='len(users) > 0'>
+ <table py:if='len(users) > 0' border="1">
<tr>
<th>
<label class="fieldlabel" py:content="fields.uid.label" />
@@ -23,13 +23,37 @@
<th>
Name
</th>
+ <th>
+ Phone
+ </th>
+ <th>
+ Unit
+ </th>
+ <th>
+ Title
+ </th>
+ <th>
+ License Plate
+ </th>
</tr>
<tr py:for="user in users">
<td>
<a href="${tg.url('/usershow',uid=user.uid)}">${user.uid}</a>
</td>
<td>
- ${user.cn}
+ ${user.givenName} ${user.sn}
+ </td>
+ <td>
+ ${user.telephoneNumber}
+ </td>
+ <td>
+ ${user.ou}
+ </td>
+ <td>
+ ${user.title}
+ </td>
+ <td>
+ ${user.carLicense}
</td>
</tr>
</table>
diff -r fb7fbc0b4fa2 -r 151601106451 ipa-server/ipaserver/ipaldap.py
--- a/ipa-server/ipaserver/ipaldap.py Mon Aug 27 12:52:26 2007 -0700
+++ b/ipa-server/ipaserver/ipaldap.py Tue Aug 28 09:20:12 2007 -0700
@@ -260,12 +260,12 @@ class IPAdmin(SimpleLDAPObject):
try:
res = self.search(*args)
+ type, obj = self.result(res)
# res = self.search_ext(args[0], args[1], filterstr=args[2], attrlist=args[3], serverctrls=sctrl)
except ldap.LDAPError, e:
raise ipaerror.gen_exception(ipaerror.LDAP_DATABASE_ERROR, None, e)
- type, obj = self.result(res)
if not obj:
raise ipaerror.gen_exception(ipaerror.LDAP_NOT_FOUND,
"no such entry for " + str(args))
@@ -283,10 +283,13 @@ class IPAdmin(SimpleLDAPObject):
try:
res = self.search(*args)
+ type, obj = self.result(res)
+ except (ldap.ADMINLIMIT_EXCEEDED, ldap.SIZELIMIT_EXCEEDED), e:
+ raise ipaerror.gen_exception(ipaerror.LDAP_DATABASE_ERROR,
+ "Too many results returned by search", e)
except ldap.LDAPError, e:
raise ipaerror.gen_exception(ipaerror.LDAP_DATABASE_ERROR, None, e)
- type, obj = self.result(res)
if not obj:
raise ipaerror.gen_exception(ipaerror.LDAP_NOT_FOUND,
"no such entry for " + str(args))
diff -r fb7fbc0b4fa2 -r 151601106451 ipa-server/xmlrpc-server/funcs.py
--- a/ipa-server/xmlrpc-server/funcs.py Mon Aug 27 12:52:26 2007 -0700
+++ b/ipa-server/xmlrpc-server/funcs.py Tue Aug 28 09:20:12 2007 -0700
@@ -385,7 +385,7 @@ class IPAServer:
# Assume the list of fields to search will come from a central
# configuration repository. A good format for that would be
# a comma-separated list of fields
- search_fields_conf_str = "uid,givenName,sn,telephoneNumber"
+ search_fields_conf_str = "uid,givenName,sn,telephoneNumber,ou,carLicense,title"
search_fields = string.split(search_fields_conf_str, ",")
criteria = self.__safe_filter(criteria)
-------------- 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/20070828/a4d6bd18/attachment.bin>
More information about the Freeipa-devel
mailing list