Remove implicit RequestContext decoration

This change removes RequestContext implicit decoration as some
applications have their own session management for the moment or don't
need this feature. Moreover this implicit decoration doesn't help
debugging.

This change doesn't disallow RequestContext decoration but applications
should require it explicitly:

 from oslo_db.sqlalchemy import enginefacade
 enginefacade.transaction_context_provider(oslo_context.RequestContext)

Closes-Bug: #1468707
Change-Id: I143f30c41e788c7aa9887c0e994f49ee55c94651
This commit is contained in:
Cedric Brandily 2015-06-25 10:00:27 +00:00
parent 77ed7d552e
commit 8811644c41
2 changed files with 3 additions and 5 deletions

View File

@ -18,7 +18,6 @@ import threading
import warnings
from oslo_config import cfg
from oslo_context import context as oslo_context
from oslo_db import exception
from oslo_db import options
@ -778,10 +777,6 @@ def transaction_context_provider(klass):
return klass
# apply the context descriptors to oslo.context.RequestContext
transaction_context_provider(oslo_context.RequestContext)
_context_manager = _TransactionContextManager(_is_global_manager=True)
"""default context manager."""

View File

@ -35,6 +35,9 @@ from oslo_db.sqlalchemy import orm
from oslo_db.sqlalchemy import test_base
enginefacade.transaction_context_provider(oslo_context.RequestContext)
class SingletonOnName(mock.MagicMock):
def __init__(self, the_name, **kw):
super(SingletonOnName, self).__init__(