sol.models – SQLAlchemy modelization¶
The application’s model objects
-
class
sol.models.AbstractBase¶ Abstract base entity class.
-
caption(html=None, localized=True)¶ Return a possibly HTML-decorated caption of the entity.
Parameters: - html – either
None(the default) or a boolean value - localized – a boolean value,
Trueby default
Return type: str
If html is
NoneorTruethen the result may be an HTML representation of the entity, otherwise it is plain text.If localized is
Falsethen the localization is turned off.- html – either
-
classmethod
check_insert(klass, session, fields)¶ Perform any check before an new instance is inserted
-
check_update(fields)¶ Perform any check before updating the instance.
Parameters: fields – a mapping containing fieldname -> valueassociationsThis implementation does nothing, but subclasses can override it at will, either to adapt incoming values or to check their validity, raising an exception if something is wrong.
-
delete()¶ Delete this instance from the database.
-
update(data, missing_only=False)¶ Update entity with given data.
Parameters: - data – a mapping kind of container
- missing_only – a boolean flag,
Falseby default
Return type: dict
Returns: a mapping between field name and a tuple
(oldvalue, newvalue), for each modified fieldFirst call
check_update()to assert the validity of incoming data, then update the instance fields.If missing_only is
Truethen only the fields that are currently empty (that is, their value is eitherNoneor an empty string) are updated. Note that in this case an exception is made forboolfields: since in SoL they always have a value (i.e. they are never missing), they are always updated.
-