X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fupstream%2Fdjango-ldapdb.git;a=blobdiff_plain;f=ldapdb%2Fmodels%2Fquery.py;h=d49b44a41d1977c8b37fdd6266b3df9fca662bfb;hp=e43be2d19dcf92bc0099500d3b3d1bbf496fe639;hb=c04580563f978929bc4f06dfa85ea7a26248d688;hpb=1fb23bec834636d0427e7ac6db92639c133ef1d2 diff --git a/ldapdb/models/query.py b/ldapdb/models/query.py index e43be2d..d49b44a 100644 --- a/ldapdb/models/query.py +++ b/ldapdb/models/query.py @@ -28,7 +28,7 @@ from django.db.models.sql.where import WhereNode as BaseWhereNode, Constraint as import ldapdb -from ldapdb.models.fields import CharField, IntegerField, ListField +from ldapdb.models.fields import CharField def get_lookup_operator(lookup_type): if lookup_type == 'gte': @@ -185,12 +185,10 @@ class Query(BaseQuery): for field in iter(self.model._meta.fields): if field.attname == 'dn': row.append(dn) - elif isinstance(field, IntegerField): - row.append(int(attrs.get(field.db_column, [0])[0])) - elif isinstance(field, ListField): - row.append(attrs.get(field.db_column, [])) + elif hasattr(field, 'from_ldap'): + row.append(field.from_ldap(attrs.get(field.db_column, []), connection=ldapdb.connection)) else: - row.append(attrs.get(field.db_column, [''])[0]) + row.append(None) yield row class QuerySet(BaseQuerySet):