diff options
author | Arthur de Jong <arthur@arthurdejong.org> | 2012-01-29 14:39:25 +0000 |
---|---|---|
committer | Arthur de Jong <arthur@arthurdejong.org> | 2012-01-29 14:39:25 +0000 |
commit | fcce277a6e8d56036f6a33bda67aa8dcc03be142 (patch) | |
tree | 0c8244da8d000d8a0029f76618e98a48a5bb976f /pynslcd/ether.py | |
parent | 0a8ff1c61c193b17b04adb0c3ced239846be855d (diff) |
split the result handling into a convert() and write() step
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1613 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'pynslcd/ether.py')
-rw-r--r-- | pynslcd/ether.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/pynslcd/ether.py b/pynslcd/ether.py index 4d6ae03..20963c3 100644 --- a/pynslcd/ether.py +++ b/pynslcd/ether.py @@ -48,16 +48,14 @@ class Search(common.Search): class EtherRequest(common.Request): - def write(self, dn, attributes, parameters): - # get values - names = attributes['cn'] - addresses = [ether_aton(x) for x in attributes['macAddress']] - # write results - for name in names: - for ether in addresses: - self.fp.write_int32(constants.NSLCD_RESULT_BEGIN) - self.fp.write_string(name) - self.fp.write(ether) + def write(self, name, ether): + self.fp.write_string(name) + self.fp.write(ether_aton(ether)) + + def convert(self, dn, attributes, parameters): + for name in attributes['cn']: + for ether in attributes['macAddress']: + yield (name, ether) class EtherByNameRequest(EtherRequest): |