Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
5f094ab4 by Cédric Krier at 2023-02-05T00:36:58+01:00
Set default attributes on Transaction __new__ method

Closes #5617
- - - - -


1 changed file:

- trytond/trytond/transaction.py


Changes:

=====================================
trytond/trytond/transaction.py
=====================================
@@ -103,22 +103,9 @@
 
     cache_keys = {'language', 'fuzzy_translation', '_datetime'}
 
-    database = None
-    readonly = False
-    connection = None
-    close = None
-    user = None
-    context = None
-    create_records = None
-    delete_records = None
-    trigger_records = None
-    check_warnings = None
-    timestamp = None
-    started_at = None
-
     def __new__(cls, new=False):
         from trytond.cache import LRUDict
         from trytond.pool import Pool
         transactions = cls._local.transactions
         if new or not transactions:
             instance = super(Transaction, cls).__new__(cls)
@@ -119,9 +106,21 @@
     def __new__(cls, new=False):
         from trytond.cache import LRUDict
         from trytond.pool import Pool
         transactions = cls._local.transactions
         if new or not transactions:
             instance = super(Transaction, cls).__new__(cls)
+            instance.database = None
+            instance.readonly = False
+            instance.connection = None
+            instance.close = None
+            instance.user = None
+            instance.context = None
+            instance.create_records = None
+            instance.delete_records = None
+            instance.trigger_records = None
+            instance.check_warnings = None
+            instance.timestamp = None
+            instance.started_at = None
             instance.cache = LRUDict(
                 _cache_transaction,
                 lambda: LRUDict(



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/5f094ab4644c78e913813fdad41b9eb83b558db5

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/5f094ab4644c78e913813fdad41b9eb83b558db5
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to