Skip to content
Snippets Groups Projects
Commit 6a0b85f2 authored by Julian Rother's avatar Julian Rother
Browse files

Made ldap_filter_params handling more robust

parent e223f161
No related branches found
No related tags found
No related merge requests found
...@@ -68,8 +68,8 @@ class ModelQuery: ...@@ -68,8 +68,8 @@ class ModelQuery:
return make_modelobjs(objs, self.model) return make_modelobjs(objs, self.model)
def filter_by(self, **kwargs): def filter_by(self, **kwargs):
filter_params = self.model.ldap_filter_params filter_params = list(self.model.ldap_filter_params)
filter_params += tuple((getattr(self.model, attr).name, value) for attr, value in kwargs.items()) filter_params += [(getattr(self.model, attr).name, value) for attr, value in kwargs.items()]
session = self.model.ldap_mapper.session.ldap_session session = self.model.ldap_mapper.session.ldap_session
objs = session.filter(self.model.ldap_search_base, filter_params) objs = session.filter(self.model.ldap_search_base, filter_params)
return make_modelobjs(objs, self.model) return make_modelobjs(objs, self.model)
......
...@@ -87,7 +87,7 @@ class BackreferenceSet(MutableSet): ...@@ -87,7 +87,7 @@ class BackreferenceSet(MutableSet):
def __get(self): def __get(self):
if self.__ldap_object.session is None: if self.__ldap_object.session is None:
return set() return set()
filter_params = self.__srcmodel.ldap_filter_params + ((self.__name, self.__ldap_object.dn),) filter_params = list(self.__srcmodel.ldap_filter_params) + [(self.__name, self.__ldap_object.dn)]
objs = self.__ldap_object.session.filter(self.__srcmodel.ldap_search_base, filter_params) objs = self.__ldap_object.session.filter(self.__srcmodel.ldap_search_base, filter_params)
return set(make_modelobjs(objs, self.__srcmodel)) return set(make_modelobjs(objs, self.__srcmodel))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment