From 33237cd39b7a6475ab80fcdc1f982139b6b28132 Mon Sep 17 00:00:00 2001 From: Pavel Merdin Date: Wed, 1 Jul 2020 09:37:02 +0100 Subject: [PATCH] Fix for underscore to dash conversion DHCP OMAPI normally uses dashes as a separator for field words. Python does not accept dashes in kwarg keys, so there is a conversion in the __lookup function to convert _ to -. However, there seems to be a bug that prevents that conversion to be actually used for some parameters. --- pypureomapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pypureomapi.py b/pypureomapi.py index 825ebc5..3c906a3 100644 --- a/pypureomapi.py +++ b/pypureomapi.py @@ -1214,7 +1214,7 @@ def __lookup(self, ltype, **kwargs): elif _k == "name": msg.obj.append((b"name", kwargs[k].encode('utf-8'))) else: - msg.obj.append((str(k).encode(), kwargs[k].encode('utf-8'))) + msg.obj.append((str(_k).encode(), kwargs[k].encode('utf-8'))) response = self.query_server(msg) if response.opcode != OMAPI_OP_UPDATE: raise OmapiErrorNotFound()