mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 00:12:07 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -175,9 +175,16 @@ class BaseCursor(_CursorProtocol):
|
|||
|
||||
def flush(self) -> None:
|
||||
""" Flush the current transaction, and run precommit hooks. """
|
||||
if self.transaction is not None:
|
||||
self.transaction.flush()
|
||||
self.precommit.run()
|
||||
# In case some pre-commit added another pre-commit or triggered changes
|
||||
# in the ORM, we must flush and run it again.
|
||||
for _ in range(10): # limit number of iterations
|
||||
if self.transaction is not None:
|
||||
self.transaction.flush()
|
||||
if not self.precommit:
|
||||
break
|
||||
self.precommit.run()
|
||||
else:
|
||||
_logger.warning("Too many iterations for flushing the cursor!")
|
||||
|
||||
def clear(self) -> None:
|
||||
""" Clear the current transaction, and clear precommit hooks. """
|
||||
|
|
@ -793,7 +800,7 @@ def connection_info_for(db_or_uri: str, readonly=False) -> tuple[str, dict]:
|
|||
for p in ('host', 'port', 'user', 'password', 'sslmode'):
|
||||
cfg = tools.config['db_' + p]
|
||||
if readonly:
|
||||
cfg = tools.config.get('db_replica_' + p, cfg)
|
||||
cfg = tools.config.get('db_replica_' + p) or cfg
|
||||
if cfg:
|
||||
connection_info[p] = cfg
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue