summaryrefslogtreecommitdiff
path: root/odoo/tools/cache.py
AgeCommit message (Collapse)Author
2018-11-29[REF] *: replace deprecated pycompat helpers for builtinsAdrian Torres
This commit replaces calls to pycompat helpers that were intended for python 2 <-> python 3 interoperability for python 3 builtins, as python 2 is no longer officially supported by Odoo. This includes: * calls to imap/izip/ifilter replaced by map/zip/filter * uses of text_type replaced by str * uses of unichr replaced by chr * calls to implements_to_string, implements_iterator removed * string_types and integer_types replaced by str, int respectively * calls to to_native replaced by calls to to_text This is done in preparation to the removal of these deprecated helpers in the following commit.
2018-11-22[MERGE] forward port branch 11.0 up to 263b388c504Christophe Simonis
2018-11-21[FIX] cache: ormcache loggerRaphael Collet
The adaptation to Python 3 was done with two mistakes: the iteration on the lru cache does not return keys, and functions are not sortable. closes odoo/odoo#28870
2017-11-08[IMP] tools: Add note to ormcache regarding closed cursorsDave Lasley
Returning a recordset from a cached method will raise an `psycopg2.OperationalError` once the cursor is closed. Add documentation to `ormcache` method indicating such See OCA/stock-logistics-barcode#93 and #8795 for example of issues Closes #19113
2017-08-20[FIX] P3: remove pycompat.{keys,items,values} helpersOlivier Dony
Now that we're closer to switching to P3 for good, these helpers have outlived their usefulness, and mostly add noise. All remaining dict.iter*() or dict.view*() must be converted to the normal keys(), values() or items() calls. Whenever the result is likely to be used for more than the scope of a loop, or when the dict needs to be modified during iteration, the calls must be wrapped in a ``list()``, to protect the new P3 semantics. Those cases are very exceptional. Also removed some dead code or improved the API to remove unnecessary conversions.
2017-08-20[FIX] P3: text model typesXavier Morel
* remove references to basestring & unicode (use relevant pycompat helpers) * remove some str calls (either entirely or replaced by relevant helper, either text or native) * use better API to avoid unnecessary conversions * remove some XML declarations in views
2017-05-16[MERGE] Forward-port saas-16 up to 5afe894f440eff3b58134d14fa7c9b43b19fe88bOlivier Dony
2017-05-16[MERGE] Forward-port saas-15 up to 878fbc75ff9ebade92f43748500e64350367a824Olivier Dony
2017-05-10[FIX] P3: list -> iterable builtins (#16811)xmo-odoo
In Python 3: * various builtins and dict methods were changed to return view/iterable objects rather than lists * and the separate Python 2 view/iterable builtins and methods were removed altogether This is problematic when using these items as list (which the happens repeatedly in Odoo), but more viciously when iterating *multiple times* over them (which also happens, which I've messed up multiple times while writing this, and which is a pain to debug even when you've just created the issue). Convert all code using these to semantics-matching cross-version helper functions to get the LCD behaviour between P2 and P3, and forbid the builtins via lint. issue #8530
2017-05-05[FIX] tools.cache: fix stats dump with geventOlivier Dony
Gevent processes have pseudo-thread objects that do no always have a `dbname`attribute. This could crash the process upon receiving a USR1 signal.
2017-05-03[REF] registry: always perform registry/cache signaling at the end of requestRaphael Collet
Problem: the update of custom models/fields is not fully transactional, and may potentially lead to an inconsistent database. An other problem is creating two custom fields by writing on a model: if the second one fails, the first one has been committed without notice. Retrying the request will give an unexpected error (duplicate field name). Solution: never commit in the middle of a request. If the changes have an impact on the registry, then mark it as invalid (with a new flag), and signal registry invalidation after everything has been committed. If the request fails, reset the registry. Both registry and cache invalidation are handled the same way.
2017-04-24[FIX] function introspection attributesxmo-odoo
Introspection attributes on function and methods were originally prefixed with func_ or im_ e.g. im_class or func_name. For coherence with the rest of the data model, Python 3 added dunder attributes (__func__, __code__) and removed the old style, the dunder attributes were backported to Python 2.6. Use dunder attributes everywhere we're currently using func_* or im_* attributes. Fixers: lib2to3.fixes.fix_funcattrs lib2to3.fixes.fix_methodattrs #8530
2016-09-02[FIX] odoo: rename imports and adapt import hooksRaphael Collet
2016-09-02[REF] openerp: move `openerp` to `odoo`Raphael Collet