mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
API.env is now an Env instance rather than an Environment instance
This commit is contained in:
parent
25a7df9615
commit
d76202fea3
@ -668,7 +668,7 @@ class Command(plugable.Plugin):
|
|||||||
on the nearest IPA server and the actual work this command
|
on the nearest IPA server and the actual work this command
|
||||||
performs is executed remotely.
|
performs is executed remotely.
|
||||||
"""
|
"""
|
||||||
if self.api.env.server_context:
|
if self.api.env.in_server:
|
||||||
target = self.execute
|
target = self.execute
|
||||||
else:
|
else:
|
||||||
target = self.forward
|
target = self.forward
|
||||||
|
@ -29,7 +29,8 @@ import re
|
|||||||
import inspect
|
import inspect
|
||||||
import errors
|
import errors
|
||||||
from errors import check_type, check_isinstance
|
from errors import check_type, check_isinstance
|
||||||
from config import Environment
|
from config import Environment, Env
|
||||||
|
import constants
|
||||||
import util
|
import util
|
||||||
|
|
||||||
|
|
||||||
@ -713,7 +714,7 @@ class API(DictProxy):
|
|||||||
self.__d = dict()
|
self.__d = dict()
|
||||||
self.__done = set()
|
self.__done = set()
|
||||||
self.register = Registrar(*allowed)
|
self.register = Registrar(*allowed)
|
||||||
self.env = Environment()
|
self.env = Env
|
||||||
super(API, self).__init__(self.__d)
|
super(API, self).__init__(self.__d)
|
||||||
|
|
||||||
def __doing(self, name):
|
def __doing(self, name):
|
||||||
|
@ -40,7 +40,7 @@ class CrudChecker(ClassChecker):
|
|||||||
frontend.Method,
|
frontend.Method,
|
||||||
frontend.Property,
|
frontend.Property,
|
||||||
)
|
)
|
||||||
config.set_default_env(api.env)
|
#config.set_default_env(api.env)
|
||||||
class user(frontend.Object):
|
class user(frontend.Object):
|
||||||
takes_params = (
|
takes_params = (
|
||||||
'givenname',
|
'givenname',
|
||||||
|
@ -764,7 +764,8 @@ class test_Command(ClassChecker):
|
|||||||
|
|
||||||
# Test in server context:
|
# Test in server context:
|
||||||
api = plugable.API(self.cls)
|
api = plugable.API(self.cls)
|
||||||
api.env.update(dict(server_context=True))
|
#api.env.update(dict(server_context=True))
|
||||||
|
api.env.in_server = True
|
||||||
api.finalize()
|
api.finalize()
|
||||||
o = my_cmd()
|
o = my_cmd()
|
||||||
o.set_api(api)
|
o.set_api(api)
|
||||||
@ -774,7 +775,8 @@ class test_Command(ClassChecker):
|
|||||||
|
|
||||||
# Test in non-server context
|
# Test in non-server context
|
||||||
api = plugable.API(self.cls)
|
api = plugable.API(self.cls)
|
||||||
api.env.update(dict(server_context=False))
|
#api.env.update(dict(server_context=False))
|
||||||
|
api.env.in_server = False
|
||||||
api.finalize()
|
api.finalize()
|
||||||
o = my_cmd()
|
o = my_cmd()
|
||||||
o.set_api(api)
|
o.set_api(api)
|
||||||
@ -907,7 +909,7 @@ class test_Object(ClassChecker):
|
|||||||
frontend.Method,
|
frontend.Method,
|
||||||
frontend.Property,
|
frontend.Property,
|
||||||
)
|
)
|
||||||
config.set_default_env(api.env)
|
#config.set_default_env(api.env)
|
||||||
api.finalize()
|
api.finalize()
|
||||||
|
|
||||||
# Test with no primary keys:
|
# Test with no primary keys:
|
||||||
@ -964,7 +966,7 @@ class test_Object(ClassChecker):
|
|||||||
frontend.Property,
|
frontend.Property,
|
||||||
backend.Backend,
|
backend.Backend,
|
||||||
)
|
)
|
||||||
config.set_default_env(api.env)
|
#config.set_default_env(api.env)
|
||||||
class ldap(backend.Backend):
|
class ldap(backend.Backend):
|
||||||
whatever = 'It worked!'
|
whatever = 'It worked!'
|
||||||
api.register(ldap)
|
api.register(ldap)
|
||||||
|
Loading…
Reference in New Issue
Block a user