author | Thierry Florac <thierry.florac@onf.fr> |
Thu, 26 Apr 2018 16:00:38 +0200 | |
changeset 172 | 8476b679fcab |
parent 171 | d6c77b2b5c4b |
child 173 | f7e43a680f42 |
--- a/src/pyams_utils/cache.py Fri Apr 13 12:23:18 2018 +0200 +++ b/src/pyams_utils/cache.py Thu Apr 26 16:00:38 2018 +0200 @@ -35,4 +35,7 @@ @adapter_config(context=IPersistent, provides=ICacheKeyValue) def persistent_cache_key_adapter(obj): - return str(int.from_bytes(obj._p_oid, byteorder='big')) + if obj._p_oid: + return str(int.from_bytes(obj._p_oid, byteorder='big')) + else: # unsaved object + return str(id(obj))