Remove use of positional decorator
The positional decorator results in poorly maintainable code in a misguided effort to emulate python3's key-word-arg only notation and functionality. This patch removes oslo.context dependance on the positional decorator. Change-Id: I9b83917fedd00a8d4fdf904208a17ebdc5cda59a
This commit is contained in:
parent
3d96a20f2c
commit
a144ebd6c3
|
@ -33,7 +33,6 @@ import uuid
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
import debtcollector
|
import debtcollector
|
||||||
from positional import positional
|
|
||||||
|
|
||||||
_request_store = threading.local()
|
_request_store = threading.local()
|
||||||
|
|
||||||
|
@ -179,7 +178,6 @@ class RequestContext(object):
|
||||||
|
|
||||||
user_idt_format = u'{user} {tenant} {domain} {user_domain} {p_domain}'
|
user_idt_format = u'{user} {tenant} {domain} {user_domain} {p_domain}'
|
||||||
|
|
||||||
@positional(enforcement=positional.WARN)
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
auth_token=None,
|
auth_token=None,
|
||||||
user=None,
|
user=None,
|
||||||
|
|
|
@ -562,13 +562,6 @@ class ContextTest(test_base.BaseTestCase):
|
||||||
'service_roles': service_roles},
|
'service_roles': service_roles},
|
||||||
ctx.to_policy_values())
|
ctx.to_policy_values())
|
||||||
|
|
||||||
def test_positional_args(self):
|
|
||||||
context.RequestContext('abc', 'def')
|
|
||||||
|
|
||||||
self.assertEqual(1, len(self.warnings.log))
|
|
||||||
self.assertIn('__init__ takes at most 1 positional',
|
|
||||||
str(self.warnings.log[0].message))
|
|
||||||
|
|
||||||
def test_policy_deprecations(self):
|
def test_policy_deprecations(self):
|
||||||
user = uuid.uuid4().hex
|
user = uuid.uuid4().hex
|
||||||
user_domain = uuid.uuid4().hex
|
user_domain = uuid.uuid4().hex
|
||||||
|
|
|
@ -5,4 +5,3 @@
|
||||||
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
pbr!=2.1.0,>=2.0.0 # Apache-2.0
|
||||||
|
|
||||||
debtcollector>=1.2.0 # Apache-2.0
|
debtcollector>=1.2.0 # Apache-2.0
|
||||||
positional>=1.1.1 # Apache-2.0
|
|
||||||
|
|
Loading…
Reference in New Issue