Add cached_property in tools

issue9277
review299951002
This commit is contained in:
Cédric Krier
2020-06-17 00:33:30 +02:00
parent 4a1f2c938b
commit c6503c1a93
5 changed files with 9 additions and 4 deletions
+1
View File
@@ -1,3 +1,4 @@
* Add cached_property in tools
* Use custom class to store record data
* Add configuration check
* Add support for properties to fields.depends
+1 -1
View File
@@ -6,7 +6,6 @@ import json
import base64
from werkzeug.wrappers import Response
from werkzeug.utils import cached_property
from werkzeug.exceptions import (
BadRequest, InternalServerError, Conflict, Forbidden, Locked,
TooManyRequests)
@@ -15,6 +14,7 @@ from trytond.protocols.wrappers import Request
from trytond.exceptions import (
TrytonException, UserWarning, LoginException, ConcurrencyException,
RateLimitException, MissingDependenciesException)
from trytond.tools import cached_property
class JSONDecoder(object):
+1 -1
View File
@@ -12,7 +12,6 @@ except ImportError:
from http import client as HTTPStatus
from werkzeug.wrappers import Request as _Request, Response
from werkzeug.utils import cached_property
from werkzeug.http import wsgi_to_bytes, bytes_to_wsgi
from werkzeug.datastructures import Authorization
from werkzeug.exceptions import abort, HTTPException
@@ -20,6 +19,7 @@ from werkzeug.exceptions import abort, HTTPException
from trytond import security, backend
from trytond.exceptions import RateLimitException
from trytond.pool import Pool
from trytond.tools import cached_property
from trytond.transaction import Transaction
from trytond.config import config
+1 -1
View File
@@ -8,7 +8,6 @@ import logging
from decimal import Decimal
from werkzeug.wrappers import Response
from werkzeug.utils import cached_property
from werkzeug.exceptions import (
BadRequest, InternalServerError, Conflict, Forbidden, Locked,
TooManyRequests)
@@ -17,6 +16,7 @@ from trytond.protocols.wrappers import Request
from trytond.exceptions import (
TrytonException, UserWarning, LoginException, ConcurrencyException,
RateLimitException, MissingDependenciesException)
from trytond.tools import cached_property
logger = logging.getLogger(__name__)
+5 -1
View File
@@ -1,5 +1,9 @@
# This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
try:
from functools import cached_property
except ImportError:
from werkzeug.utils import cached_property
from .misc import (
file_open, get_smtp_server, reduce_ids, reduce_domain,
@@ -10,7 +14,7 @@ from .decimal_ import decistmt
__all__ = ['file_open', 'get_smtp_server', 'reduce_ids',
'reduce_domain', 'grouped_slice', 'is_instance_method', 'resolve',
'strip_wildcard', 'lstrip_wildcard', 'rstrip_wildcard', 'slugify',
'decistmt', 'ClassProperty', 'cursor_dict']
'decistmt', 'ClassProperty', 'cursor_dict', 'cached_property']
class ClassProperty(property):