From 3071301ee48117e25fd3baea683cc1e724ae6c76 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Fri, 13 May 2011 07:04:13 +0000 Subject: 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 --- pynslcd/host.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'pynslcd/host.py') 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): -- cgit v1.2.3