1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

netcmd: models: Model.from_message should be internal

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:
Rob van der Linde 2024-02-27 12:49:12 +13:00 committed by Andrew Bartlett
parent 993b6da2db
commit a1345442cc
2 changed files with 4 additions and 4 deletions

View File

@ -141,7 +141,7 @@ class Model(metaclass=ModelMeta):
return "top"
@classmethod
def from_message(cls, ldb, message):
def _from_message(cls, ldb, message):
"""Create a new model instance from the Ldb Message object.
:param ldb: Ldb connection
@ -280,7 +280,7 @@ class Model(metaclass=ModelMeta):
else:
raise
return cls.from_message(ldb, res[0])
return cls._from_message(ldb, res[0])
else:
return cls.query(ldb, **kwargs).get()
@ -360,7 +360,7 @@ class Model(metaclass=ModelMeta):
self._apply(ldb, res[0])
else:
# Existing Message was stored to work out what fields changed.
existing_obj = self.from_message(ldb, self._message)
existing_obj = self._from_message(ldb, self._message)
# Only modify replace or modify fields that have changed.
# Any fields that are set to None or an empty list get unset.

View File

@ -58,7 +58,7 @@ class Query:
else:
model = self.model
return model.from_message(self.ldb, message)
return model._from_message(self.ldb, message)
def first(self):
"""Returns the first item in the Query or None for no results."""