We must convert in ModelSQL.read the rule domains like the ModelSQL.write and
ModelSQL.delete convert their rule without the active test to have the same
result.
issue9819
review300951006
By using a class with slots instead of standard dict, we can reduce a lot the
memory usage to store the record data in the caches and values.
Also we can rely on the data in the cache to exist only for real field which
can be used to create a fast path in ModelStorage.__getattr__.
As now storing data in the cache has no extra cost, we can store data from the
transactional cache in the local. This allow also to have a shorter path in
ModelStorage.__getattr__.
For more memory efficiency, we remove the record from the cache instead of
clearing them. It was better to clear a dict but a record is less expensive to
re-instantiate than clearing.
issue9369
issue9225
review297861002
We add the flake8 configuration used so we ensure everyone uses the same.
We remove the usage of __all__ for non public API.
When possible, we rationalize the class name according to its __name__ and module.
issue9082
review297061002
On distributed setup, the cache is not synchronized instantaneously so we can
not use the cache if the record was modified by another process since the last
synchronisation.
issue9013
review262841002
We sent an order to the client for action and xxx2Many so its screen has
always a default order set.
To position a new record on non editable tree, we use the order of the 'id'
column if presents.
issue8880
review276501003
Databases are too random about rounding when casting epoch into numerical
value. So it is better to check against inequality of the string.
issue8779
review254571002
None can not be compared to a class so we always use strings to order before
grouping. Also dictionary can not be compared neither.
issue8265
review253351002
Field may have a context defined so when it instantiate a relational record,
the field should set this context like when the record is read from the
database in ModelStorage.__getattr__.
And when such field is read as related field, the context should also be set.
issue8225
review287171002
The rule may depend on indirect field written latter so it must be checked
after the storage of those fields.
On write, the rule must be checked before the modification but also after to
ensure users do not generate records that they can not modify after.
issue7403
review53301002
The exception message could contain non-ASCII errors for which standard
__str__ may fail, but as the database should always be in UTF-8 we may except
that unicode will not fail.
issue6128
review43971002
The call to Translation.delete_ids has a cost as it does search queries. So it
is better to not call it if we already know that there is nothing to delete.
issue7118
review37981003
This prevent to fill the cache of the instances created with wrong values for
left/right fields. And it ensure that the validation code has valid MPTT
values.
issue6591
review34211002
Some back-ends have constraint on the length of data name, they usually
silently truncate them, but this can create collision. The solution is to hash
the name when it is too long.
issue4620
issue6494
review37381003
There is no guarantee that the method will not raise a database error on the
first registration because it can rely on other tables being registered.
So the method must be called only when needed. This is when the table already
exists and has records. In this case other tables also already exist.
issue6409