Commit 2f7436733aa2738de4b27d31a32c5885d5e75545

Authored by selurvedu
1 parent 006b0cce

Rename arguments in get_from_object()

@@ -369,14 +369,14 @@ def set_access_key(tender, access_token): @@ -369,14 +369,14 @@ def set_access_key(tender, access_token):
369 return tender 369 return tender
370 370
371 371
372 -def get_from_object(obj, attribute): 372 +def get_from_object(obj, path):
373 """Gets data from a dictionary using a dotted accessor-string""" 373 """Gets data from a dictionary using a dotted accessor-string"""
374 - jsonpath_expr = parse_path(attribute) 374 + jsonpath_expr = parse_path(path)
375 return_list = [i.value for i in jsonpath_expr.find(obj)] 375 return_list = [i.value for i in jsonpath_expr.find(obj)]
376 if return_list: 376 if return_list:
377 return return_list[0] 377 return return_list[0]
378 else: 378 else:
379 - raise AttributeError('Attribute not found: {0}'.format(attribute)) 379 + raise AttributeError('Attribute not found: {0}'.format(path))
380 380
381 381
382 def set_to_object(obj, attribute, value): 382 def set_to_object(obj, attribute, value):
Please register or login to post a comment