P2 and P3 subprocess stdout seem to have very odd/different behaviours
in the face of mixing select and buffering.
Use raw/low-level IO (os.read) with select to try and fix that
up. Also read more than one byte at a time since os.read will not
block *if* the fd is readable, it will just get whatever data is
immediately available.
In P2, list comprehensions "leak" their variables to the surrounding
scope, in this case leading to "stl" from the first listcomp being
visible to the second one leading to code which does not break but
does not seem to make any sense.
/cc @csn-odoo
Python 3 removed "universal"
ordering. ``ResCompany.fiscalyear_lock_date`` is not required and thus
needs a fallback in case it's empty lest we try comparing a string and
None or False, which is an error.
The field 'location_id' on quant package is not computed anymore, as all
quants of a package are in the same location we take the location of the
first quant
When you use the produce wizard of mrp, you can select the lot_id of any
existing prosuct to set on the consumed product.
To avoid the seletion of a lot of another product, we set a domain
showing only the lots of the current product.
When a serial number is set or changed on a move line during a picking,
we automatically set the quantity done to 1 because, you will always
process one quantity of the product having the serial number you've just
entered
As of P3 socket.error is replaced by IOError and the underlying error
code must be accessed with `.errno `. This also worked in P2, so simply
use that all the time.
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.
- jcconv is not P3-ready and is only optional, for use on the POSBox
firmware for Japanese charset support in some receipt printers
(The POSBox firmware is still based on Odoo 8 + PY2 at this time)
- wsgiref is built-in since Python 2.5, and the one on pypi does not work
on Python 3.2+
Merge wizard contained dead code with references to an unused lib for
validating emails. Removing everything is easier.
+ remove unnecessary pycompat wrapping for safe use of dict.items()
No formal decision there, and the stdlib API seems like a PITA as it's
based around native strings, not bytes and not text.
* try to use cross-model API instead of random encode/decode
* unicode all the mail_template things
* formataddr *requires* a text tuple now
In P2, formataddr((False, False)) "worked" (generated "False
<False>"), in P3 it will fail and blow up.
* attachments are quite definitely bytes
* remove try_coerce_ascii because it's garbage
XMLRPC dumps returns text rather than bytes (for reasons unknown),
which does not suit Werkzeug's WSGI server, we need to encode the
body.
For simplicity and future-proofiness, return Werkzeug responses
instead, Werkzeug takes care of encoding text and passing bytes
through.
Otherwise when the subquery is somehow injected in the parent
query (didn't find where but...) it's b-prefixed and treated as a
binary rather than a sub-query somehow, which fails.
* IrValues.value should be a binary field, since pickle encodes
objects to bytes
* Which means the "action" string must be encoded before storage and
decoded before use
* Remove complete garbage mess of random encodings during XML
conversion, this probably still requires serious thinking and fixing
but it seems to run for now (yay)
* unichr -> pycompat (builtin removed from Python 3, ``chr`` has
become unicode-aware)
* Psycopg2 bytea values (binary fields) are returned as memoryviews in
P3 but buffers in P2
* Both bytes and (text) strings are conventionally iterable in
P3 (they have a __iter__ method), so fix up the exclusion pattern
for flatten