Commit 2f7436733aa2738de4b27d31a32c5885d5e75545
1 parent
006b0cce
Rename arguments in get_from_object()
Showing
1 changed file
with
3 additions
and
3 deletions
| ... | ... | @@ -369,14 +369,14 @@ def set_access_key(tender, access_token): |
| 369 | 369 | return tender |
| 370 | 370 | |
| 371 | 371 | |
| 372 | -def get_from_object(obj, attribute): | |
| 372 | +def get_from_object(obj, path): | |
| 373 | 373 | """Gets data from a dictionary using a dotted accessor-string""" |
| 374 | - jsonpath_expr = parse_path(attribute) | |
| 374 | + jsonpath_expr = parse_path(path) | |
| 375 | 375 | return_list = [i.value for i in jsonpath_expr.find(obj)] |
| 376 | 376 | if return_list: |
| 377 | 377 | return return_list[0] |
| 378 | 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 | 382 | def set_to_object(obj, attribute, value): | ... | ... |
Please
register
or
login
to post a comment