# HG changeset patch # User sylvain.thenault@logilab.fr # Date 1235651473 -3600 # Node ID 0928daea04e9c6c07ac33a6932d5a9302e3ef921 # Parent 3ec0a7bd87aecebb46beeb7df79cc6384183c708 fix ldapsource w/ restriction on unsupported relation (return no results in that case) diff -r 3ec0a7bd87ae -r 0928daea04e9 server/sources/ldapuser.py --- a/server/sources/ldapuser.py Thu Feb 26 13:12:39 2009 +0100 +++ b/server/sources/ldapuser.py Thu Feb 26 13:31:13 2009 +0100 @@ -632,7 +632,10 @@ filter = '(%s%s)' % (self._ldap_attrs[relation.r_type], rhs.accept(self)) except KeyError: - assert relation.r_type == 'password' # 2.38 migration + # unsupported attribute + self.source.warning('%s source can\'t handle relation %s, no ' + 'results will be returned from this source', + self.source.uri, relation) raise UnknownEid # trick to return no result return filter diff -r 3ec0a7bd87ae -r 0928daea04e9 server/test/unittest_ldapuser.py --- a/server/test/unittest_ldapuser.py Thu Feb 26 13:12:39 2009 +0100 +++ b/server/test/unittest_ldapuser.py Thu Feb 26 13:31:13 2009 +0100 @@ -33,8 +33,8 @@ repo, cnx = init_test_database('sqlite', config=config) class LDAPUserSourceTC(RepositoryBasedTC): - repo = repo - + repo, cnx = repo, cnx + def patch_authenticate(self): self._orig_authenticate = LDAPUserSource.authenticate LDAPUserSource.authenticate = nopwd_authenticate @@ -242,7 +242,10 @@ ['users', 'cochon'], ['users', 'syt']]) - + def test_cd_restriction(self): + rset = self.execute('EUser X WHERE X creation_date > "2009-02-01"') + self.assertEquals(len(rset), 2) # admin/anon but no ldap user since it doesn't support creation_date + def test_union(self): afeids = self.execute('State X') ueids = self.execute('EUser X')