Commit 00166886 authored by Tomáš Peterka's avatar Tomáš Peterka

[hal_json] Allow more getter names like "asX" and "hasX"

parent a7d8efae
......@@ -236,12 +236,13 @@ def getAttrFromAnything(search_result, select, search_property_getter, kwargs):
# prepare accessor/getter name because this must be the first tried possibility
# getter is preferred way how to obtain properties - property itself is the second
if not select.startswith('get') and select[0] not in string.ascii_uppercase:
getter_regex = re.compile('^(get|as|has)[A-Z]')
if getter_regex.match(select) or select[0] in string.ascii_uppercase:
# it is either getter (starts with "get", "has" or "as") or a Script (starts with capital letter)
accessor_name = select
else:
# maybe a hidden getter (variable accessible by a getter)
accessor_name = 'get' + UpperCase(select)
else:
# or obvious getter (starts with "get" or Capital letter - Script)
accessor_name = select
# Following value resolution is copied from product/ERP5Form/ListBox.py#L2223
# 1. resolve attribute on unwrapped object using getter
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment