File: resiter.py

package info (click to toggle)
python-ldap 3.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,248 kB
  • sloc: python: 9,465; ansic: 2,828; makefile: 132; sh: 68
file content (41 lines) | stat: -rw-r--r-- 1,243 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
"""
ldap.resiter - processing LDAP results with iterators

See https://www.python-ldap.org/ for details.
"""

from ldap.pkginfo import __version__, __author__, __license__


class ResultProcessor:
    """
    Mix-in class used with ldap.ldapopbject.LDAPObject or derived classes.
    """

    def allresults(self, msgid, timeout=-1, add_ctrls=0):
        """
        Generator function which returns an iterator for processing all LDAP operation
        results of the given msgid like retrieved with LDAPObject.result3() -> 4-tuple
        """
        result_type, result_list, result_msgid, result_serverctrls, _, _ = \
            self.result4(
                msgid,
                0,
                timeout,
                add_ctrls=add_ctrls
            )
        while result_type and result_list:
            yield (
                result_type,
                result_list,
                result_msgid,
                result_serverctrls
            )
            result_type, result_list, result_msgid, result_serverctrls, _, _ = \
                self.result4(
                    msgid,
                    0,
                    timeout,
                    add_ctrls=add_ctrls
                )
        return # allresults()