changeset d51a76a6019d in trytond:default
details: https://hg.tryton.org/trytond?cmd=changeset;node=d51a76a6019d
description:
Use freezed context in order function
The hash method can no hash tuple containing unhashable element like a
list.
issue8265
review265341002
diffstat:
trytond/model/modelsql.py | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diffs (23 lines):
diff -r 5733f5ca617d -r d51a76a6019d trytond/model/modelsql.py
--- a/trytond/model/modelsql.py Wed Apr 24 23:46:59 2019 +0200
+++ b/trytond/model/modelsql.py Thu Apr 25 15:24:01 2019 +0200
@@ -20,7 +20,7 @@
from trytond.transaction import Transaction
from trytond.pool import Pool
from trytond.pyson import PYSONEncoder, PYSONDecoder
-from trytond.cache import LRUDict
+from trytond.cache import LRUDict, freeze
from trytond.exceptions import ConcurrencyException
from trytond.rpc import RPC
from trytond.config import config
@@ -903,9 +903,7 @@
def orderfunc(row):
Target, ctx = groupfunc(row)
- return (
- Target.__name__ if Target else '',
- hash(tuple(ctx.items())))
+ return (Target.__name__ if Target else '', freeze(ctx))
for (Target, ctx), rows in groupby(
sorted(result, key=orderfunc), key=groupfunc):