mango r254 - in branches/django: . mango www



Author: ovitters
Date: Tue Jun 24 21:38:52 2008
New Revision: 254
URL: http://svn.gnome.org/viewvc/mango?rev=254&view=rev

Log:
	* mango/views.py (list_users): Limit the number of attributes that are
	requested. Additionally, change the XML we pass on to the template.
	The new XML uses the same node name as the name of the LDAP attribute.
	* www/list_users.xsl: Look for the new element names.


Modified:
   branches/django/   (props changed)
   branches/django/ChangeLog
   branches/django/mango/views.py
   branches/django/www/list_users.xsl

Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py	(original)
+++ branches/django/mango/views.py	Tue Jun 24 21:38:52 2008
@@ -88,7 +88,7 @@
     if not l:
         return HttpResponseServerError('Cannot connect to LDAP?')
 
-    queryset = models.Users.search()
+    queryset = models.Users.search(attrlist=('uid', 'cn', 'mail'))
     
     paginator = Paginator(queryset, 25)
     try:
@@ -99,14 +99,9 @@
     for obj in page.object_list:
         usernode = ET.SubElement(pagenode, 'user')
         
-        node = ET.SubElement(usernode, 'uid')
-        node.text = obj.uid
-
-        node = ET.SubElement(usernode, 'name')
-        node.text = obj.cn
-
-        node = ET.SubElement(usernode, 'email')
-        node.text = obj.mail
+        for item in ('uid', 'cn', 'mail'):
+            node = ET.SubElement(usernode, item)
+            node.text = getattr(obj, item)
 
     return get_xmlresponse(doc, "list_users.xsl")
 

Modified: branches/django/www/list_users.xsl
==============================================================================
--- branches/django/www/list_users.xsl	(original)
+++ branches/django/www/list_users.xsl	Tue Jun 24 21:38:52 2008
@@ -52,14 +52,14 @@
       <tr class="row-{position() mod 2}">
        <td>
         <a href="edit/{uid}/">
-         <xsl:apply-templates select="uid"/>
+         <xsl:value-of select="uid"/>
         </a>
        </td>
        <td>
-        <xsl:apply-templates select="name"/>
+        <xsl:value-of select="cn"/>
        </td>
        <td>
-        <xsl:apply-templates select="email"/>
+        <xsl:value-of select="mail"/>
        </td>
        <td>
        </td>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]