From 2a52eb770ba8d1c81526a4005d50b91a6419fe42 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 12 Jan 2019 22:43:01 +0100 Subject: [PATCH] Renamed value variable in expand_value_from_context to _value to prevent common name clashes with attributes named 'value' in the context --- platypush/message/request/__init__.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/platypush/message/request/__init__.py b/platypush/message/request/__init__.py index 9bf1c008a1..50838a8f76 100644 --- a/platypush/message/request/__init__.py +++ b/platypush/message/request/__init__.py @@ -112,7 +112,7 @@ class Request(Message): @classmethod - def expand_value_from_context(cls, value, **context): + def expand_value_from_context(cls, _value, **context): for (k, v) in context.items(): if isinstance(v, Message): v = json.loads(str(v)) @@ -126,14 +126,14 @@ class Request(Message): pass parsed_value = '' - if not isinstance(value, str): - parsed_value = value + if not isinstance(_value, str): + parsed_value = _value - while value and isinstance(value, str): - m = re.match('([^\$]*)(\${\s*(.+?)\s*})(.*)', value) + while _value and isinstance(_value, str): + m = re.match('([^\$]*)(\${\s*(.+?)\s*})(.*)', _value) if m and not m.group(1).endswith('\\'): prefix = m.group(1); expr = m.group(2); - inner_expr = m.group(3); value = m.group(4) + inner_expr = m.group(3); _value = m.group(4) try: context_value = eval(inner_expr) @@ -152,8 +152,8 @@ class Request(Message): or isinstance(context_value, dict) else str(context_value)) else: - parsed_value += value - value = '' + parsed_value += _value + _value = '' try: return json.loads(parsed_value) except Exception as e: return parsed_value