diff --git a/destral/openerp.py b/destral/openerp.py index 9d18c3f..4ca2122 100644 --- a/destral/openerp.py +++ b/destral/openerp.py @@ -36,7 +36,7 @@ def __init__(self, **kwargs): if hasattr(tools.config, 'parse'): tools.config.parse() from tools import config as default_config - from ctx import _cursor_context + from ctx import _cursor_context, _ws_info self.config = update_config(default_config, **config) import pooler import workflow @@ -44,6 +44,7 @@ def __init__(self, **kwargs): self.db = None self.pool = None self.cursor_stack = _cursor_context + self.ws_stack = _ws_info if 'db_name' in config: try: self.db_name = config['db_name'] diff --git a/destral/transaction.py b/destral/transaction.py index 0f65993..f6bcde0 100644 --- a/destral/transaction.py +++ b/destral/transaction.py @@ -32,6 +32,7 @@ class Transaction(local): cursor = None user = None context = None + ws = None def __init__(self): pass @@ -48,6 +49,9 @@ def start(self, database_name, user=1, context=None): self.pool = self.service.pool self.cursor = self.service.db.cursor() self.service.cursor_stack.push(self.cursor) + from tools import WebServiceTracker + self.ws = WebServiceTracker(db=self.service.db) + self.service.ws_stack.push(self.ws) self.user = user try: receivers = DB_CURSOR_EXECUTE.receivers @@ -63,6 +67,9 @@ def stop(self): if self.cursor is not None: self.service.cursor_stack.pop() self.cursor.close() + if self.ws is not None: + self.service.ws_stack.pop() + self.ws = None self.service = None self.cursor = None self.user = None @@ -87,6 +94,7 @@ def __exit__(self, type, value, traceback): def _assert_stopped(self, deep=False): try: assert self.service is None + assert self.ws is None assert self.database is None assert self.cursor is None assert self.pool is None