You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[REF] util.views: moved views/html convert helpers from BS5 script
Move xpath keywords / where clause functions from base/16.0
pre-90-convert-bootstrap5.py script into util.views and add shortcut
methods for them in converter class. Also refactored to make them
usable with arbitrary converters.
Revise converter API, especially simplified classmethods / remove
oneshot aliases (it's easier to just instantiate the converter first).
Refactor parse/unparse string arch code into separate helper
functions, and add a `ArchEditor` context manager to
parse-edit-unparse an arch within a context (similar to edit_views).
Make sure EtreeConverter is pickle-able for multiprocessing:
concurrent.futures ProcessPoolExecutor uses multiprocessing to spawn
its subprocess workers. That requires memory data from the main
process to be transferred by serializing and deserializing, using the
pickle library. To make this work:
- the converter function must not be an anonymous "factory" function,
e.g. one generated as a nested function, so unaccessible from the
outer scope.
- instance values in the serialized objects must also be pickleable.
Therefore the following changes have been done:
- the converter function is now a method of the converter class
- to keep @lru_cache decorator on the method, the entire class is
made hashable, this is done by computing a hash of the provided
arguments to `__init__`, making some attributes "private", and
adding read-only properties to access them.
- to make the instances pickable, the compiled coversions are first
removed from the pickle-able `__dict__`, because `lxml.XPath`
objects are not python-native, and they're re-compiled when the
instances are de-serialized.
upgrade PR: odoo/upgrade#5431
0 commit comments