Prevent plugins from breaking in case of concatenations with None elements

This commit is contained in:
Fabio Manganiello 2018-05-14 19:06:11 +02:00
parent 21ac8d7899
commit 9923742e74
2 changed files with 9 additions and 2 deletions

View file

@ -135,7 +135,10 @@ class Request(Message):
else:
try:
parsed_value += prefix + eval(inner_expr)
expanded_expr = eval(inner_expr)
parsed_value += prefix
if expanded_expr is not None:
parsed_value += expanded_expr
except Exception as e:
logging.exception(e)
parsed_value += prefix + expr

View file

@ -44,7 +44,11 @@ class GoogleMapsPlugin(GooglePlugin):
address['postal_code'] = addr_component['long_name']
if 'address' in address and 'street_number' in address:
address['address'] += ' ' + address['street_number']
address['address'] = '{}{}{}'.format(
(address['address'] or ''),
(' ' if address['street_number'] else ''),
(address['street_number'] or ''))
del(address['street_number'])
return Response(output=address)