From c90a537983f025b7054b48b8be2d3752cbb3d389 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Thu, 2 Jun 2016 23:38:08 +0200 Subject: Fix pynslcd expression representation The problem was that the ExpressionMapping string value did not include the quotes which will cause problems when printing the expression (e.g. when logging or dumping config, etc.). --- pynslcd/attmap.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pynslcd/attmap.py b/pynslcd/attmap.py index b64a048..6012d39 100644 --- a/pynslcd/attmap.py +++ b/pynslcd/attmap.py @@ -77,7 +77,7 @@ class ExpressionMapping(str): def __init__(self, value): """Parse the expression as a string.""" - self.expression = Expression(value) + self.expression = Expression(value[1:-1]) super(ExpressionMapping, self).__init__(value) def values(self, variables): @@ -127,7 +127,7 @@ class Attributes(dict): def __setitem__(self, attribute, mapping): # translate the mapping into a mapping object if mapping[0] == '"' and mapping[-1] == '"': - mapping = ExpressionMapping(mapping[1:-1]) + mapping = ExpressionMapping(mapping) elif '(' in mapping: mapping = FunctionMapping(mapping) else: -- cgit v1.2.3