[FIX] P3: random.sample on a recordset

In P3, random.sample requires that its parameter be a Sequence or a
Set. This blows up _cart_accessories.

So opt BaseModel into both ABC, seems to work fine.
This commit is contained in:
Xavier Morel
2017-06-26 16:45:02 +02:00
parent d5c80fd92d
commit 5810ea2a97
+5 -1
View File
@@ -22,6 +22,8 @@
"""
import datetime
import collections
import dateutil
import functools
import itertools
@@ -4952,7 +4954,9 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
}
return result
collections.Set.register(BaseModel)
# not exactly true as BaseModel doesn't have __reversed__, index or count
collections.Sequence.register(BaseModel)
class RecordCache(MutableMapping):
""" Implements a proxy dictionary to read/update the cache of a record.