Integrating formula editor
This commit is contained in:
@@ -115,6 +115,30 @@ class DbObject:
|
||||
return props
|
||||
|
||||
def update(self, *args, **kwargs):
|
||||
"""
|
||||
Update instance attributes with the provided arguments or keyword arguments.
|
||||
|
||||
This method allows updating the attributes of an object based on the provided
|
||||
dictionary-like argument or explicit keyword arguments. It ensures that only
|
||||
permitted attributes will be updated, excluding any internal or restricted
|
||||
attributes. If both a dictionary and keyword arguments are provided, the
|
||||
properties from the dictionary will be updated first, followed by the
|
||||
keyword arguments.
|
||||
|
||||
There will be only one update in database.
|
||||
|
||||
:param args: Zero or one positional argument is allowed. If provided, it must be
|
||||
either a dictionary or an instance of SimpleNamespace whose properties
|
||||
are used to update the instance.
|
||||
:param kwargs: Keyword arguments that represent the properties and their new
|
||||
values to be updated on the instance.
|
||||
:return: The updated instance (self).
|
||||
:rtype: object
|
||||
|
||||
:raises ValueError: If more than one positional argument is provided, or if the
|
||||
provided argument is neither a dictionary nor an instance of
|
||||
SimpleNamespace.
|
||||
"""
|
||||
if len(args) > 1:
|
||||
raise ValueError("Only one argument is allowed")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user