mirror of
https://github.com/samba-team/samba.git
synced 2024-12-22 13:34:15 +03:00
netcmd: models: model __json__ method should call as_dict instead
The comment about RelatedField is not really relevant so removed that part, RelatedField isn't used at this point. The idea with RelatedField is that it fetches the object (vs DnField which just returns a Dn). Signed-off-by: Rob van der Linde <rob@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
parent
181764a5d6
commit
982ebebfbe
@ -111,13 +111,8 @@ class Model(metaclass=ModelMeta):
|
||||
return self.dn == other.dn
|
||||
|
||||
def __json__(self):
|
||||
"""Automatically called by custom JSONEncoder class.
|
||||
|
||||
When turning an object into json any fields of type RelatedField
|
||||
will also end up calling this method.
|
||||
"""
|
||||
if self.dn is not None:
|
||||
return str(self.dn)
|
||||
"""Automatically called by custom JSONEncoder class."""
|
||||
return self.as_dict()
|
||||
|
||||
@staticmethod
|
||||
def get_base_dn(ldb):
|
||||
|
Loading…
Reference in New Issue
Block a user