forked from platypush/platypush
Support attribute
parameter on Function
schema fields.
This commit is contained in:
parent
d890b6cbe8
commit
0e3cabc5f6
1 changed files with 3 additions and 1 deletions
|
@ -22,7 +22,9 @@ class StrippedString(fields.Function): # lgtm [py/missing-call-to-init]
|
|||
|
||||
|
||||
class Function(fields.Function): # lgtm [py/missing-call-to-init]
|
||||
def _get_attr(self, obj, attr: str):
|
||||
def _get_attr(self, obj, attr: str, _recursive=True):
|
||||
if self.attribute and _recursive:
|
||||
return self._get_attr(obj, self.attribute, False)
|
||||
if hasattr(obj, attr):
|
||||
return getattr(obj, attr)
|
||||
elif hasattr(obj, 'get'):
|
||||
|
|
Loading…
Reference in a new issue