mango r240 - in branches/django: . mango



Author: ovitters
Date: Mon Jun 23 16:51:06 2008
New Revision: 240
URL: http://svn.gnome.org/viewvc/mango?rev=240&view=rev

Log:
	Fix regressions due to instruction of new method to search LDAP (SVN
	revision 237).
	* mango/models.py (UserGroups, Users.groups): Add default filter to
	UserGroups. Update groups function to ensure the filter uses a Q
	object.
	* mango/views.py (get_xmldoc, edit_user): Use Q when providing a
	filter for LDAP.


Modified:
   branches/django/   (props changed)
   branches/django/ChangeLog
   branches/django/mango/models.py
   branches/django/mango/views.py

Modified: branches/django/mango/models.py
==============================================================================
--- branches/django/mango/models.py	(original)
+++ branches/django/mango/models.py	Mon Jun 23 16:51:06 2008
@@ -208,7 +208,7 @@
 
     BASEDN = settings.MANGO_CFG['ldap_groups_basedn']
     MULTI_ATTRS = set(('memberUid', 'objectClass'))
-
+    FILTER = Q(objectClass='posixGroup')
 
 class Users(LdapObject):
 
@@ -223,7 +223,7 @@
     @property
     def groups(self):
         if self._groups is None:
-            self._groups = UserGroups.search('(memberUid=%s)' % self.__dict__['uid'])
+            self._groups = UserGroups.search(Q(memberUid=self.__dict__['uid']))
 
         return self._groups
 

Modified: branches/django/mango/views.py
==============================================================================
--- branches/django/mango/views.py	(original)
+++ branches/django/mango/views.py	Mon Jun 23 16:51:06 2008
@@ -29,8 +29,7 @@
     # TODO: 
     #  - determine if user is logged in, if so:
     #    add user details to XML
-    filter = ldap.filter.filter_format('(&(objectClass=posixAccount)(uid=%s))', ('ovitters',))
-    users = models.Users.search(filter)
+    users = models.Users.search(Q(uid='ovitters'))
     if len(users) == 1:
         user = users[0]
 
@@ -113,8 +112,7 @@
     if not l:
         return HttpResponseServerError('Cannot connect to LDAP?')
 
-    filter = ldap.filter.filter_format('(&(objectClass=posixAccount)(uid=%s))', (user,))
-    users = models.Users.search(filter)
+    users = models.Users.search(Q(uid=user))
 
     if len(users) != 1:
         raise Http404()



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