Arthur de Jong

Open Source / Free Software developer

summaryrefslogtreecommitdiffstats
path: root/pynslcd/host.py
diff options
context:
space:
mode:
authorArthur de Jong <arthur@arthurdejong.org>2011-05-13 09:04:13 +0200
committerArthur de Jong <arthur@arthurdejong.org>2011-05-13 09:04:13 +0200
commit3071301ee48117e25fd3baea683cc1e724ae6c76 (patch)
tree506ca35939abfd10fee95f1de80afa5a076e5a58 /pynslcd/host.py
parent4c19151250e318fa38dac33e5db1397b9d95a43e (diff)
simplify request handling by passing read parameters around in a dict instead of setting object properties (this mainly simplifies search filter building)
git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/nss-pam-ldapd@1455 ef36b2f9-881f-0410-afb5-c4e39611909c
Diffstat (limited to 'pynslcd/host.py')
-rw-r--r--pynslcd/host.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/pynslcd/host.py b/pynslcd/host.py
index 5fcbc31..85e88a6 100644
--- a/pynslcd/host.py
+++ b/pynslcd/host.py
@@ -30,7 +30,7 @@ filter = '(objectClass=ipHost)'
class HostRequest(common.Request):
- def write(self, dn, attributes):
+ def write(self, dn, attributes, parameters):
hostname = common.get_rdn_value(dn, attmap['cn'])
hostnames = attributes['cn']
if not hostnames:
@@ -54,19 +54,17 @@ class HostRequest(common.Request):
class HostByNameRequest(HostRequest):
action = constants.NSLCD_ACTION_HOST_BYNAME
- filter_attrs = dict(cn='name')
- def read_parameters(self):
- self.name = self.fp.read_string()
+ def read_parameters(self, fp):
+ return dict(cn=fp.read_string())
class HostByAddressRequest(HostRequest):
action = constants.NSLCD_ACTION_HOST_BYADDR
- filter_attrs = dict(ipHostNumber='address')
- def read_parameters(self):
- self.address = self.fp.read_address()
+ def read_parameters(self, fp):
+ return dict(ipHostNumber=fp.read_address())
class HostAllRequest(HostRequest):