mango r211 - in branches/django: . mango
- From: ovitters svn gnome org
- To: svn-commits-list gnome org,gnome-sysadmin gnome org
- Subject: mango r211 - in branches/django: . mango
- Date: Sat, 21 Jun 2008 22:09:13 +0000 (UTC)
Author: ovitters
Date: Sat Jun 21 22:09:13 2008
New Revision: 211
URL: http://svn.gnome.org/viewvc/mango?rev=211&view=rev
Log:
* mango/views.py (list_users): Return XML instead of debug text.
For now, just add all LDAP users in the XML.
Modified:
branches/django/ (props changed)
branches/django/ChangeLog
branches/django/mango/views.py
Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py (original)
+++ branches/django/mango/views.py Sat Jun 21 22:09:13 2008
@@ -42,16 +42,30 @@
def list_users(request):
+ doc, root = get_xmldoc('List Users', request)
+ el = ET.SubElement(root, 'listusers')
+
l = models.LdapUtil().handle
if not l:
return HttpResponseServerError('Cannot connect to LDAP?')
filter = '(objectClass=posixAccount)'
- stuff = l.search_s(settings.MANGO_CFG['ldap_users_basedn'],
+ users = l.search_s(settings.MANGO_CFG['ldap_users_basedn'],
ldap.SCOPE_SUBTREE, filter, None)
+
+ for dn, user in users:
+ usernode = ET.SubElement(el, 'user')
+
+ node = ET.SubElement(usernode, 'uid')
+ node.text = user['uid'][0]
+
+ node = ET.SubElement(usernode, 'name')
+ node.text = user['cn'][0]
+
+ node = ET.SubElement(usernode, 'email')
+ node.text = user['mail'][0]
- html = '<pre>%s</pre>' % "\n".join(["%s: %s" % (item[0], repr(item[1])) for item in stuff])
- return HttpResponse(html)
+ return get_xmlresponse(doc, "../www/list_users.xsl")
def test_index(request):
doc, root = get_xmldoc('Login Page', request)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]