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
|
||||
performs is executed remotely.
|
||||
"""
|
||||
if self.api.env.server_context:
|
||||
if self.api.env.in_server:
|
||||
target = self.execute
|
||||
else:
|
||||
target = self.forward
|
||||
|
@ -29,7 +29,8 @@ import re
|
||||
import inspect
|
||||
import errors
|
||||
from errors import check_type, check_isinstance
|
||||
from config import Environment
|
||||
from config import Environment, Env
|
||||
import constants
|
||||
import util
|
||||
|
||||
|
||||
@ -713,7 +714,7 @@ class API(DictProxy):
|
||||
self.__d = dict()
|
||||
self.__done = set()
|
||||
self.register = Registrar(*allowed)
|
||||
self.env = Environment()
|
||||
self.env = Env
|
||||
super(API, self).__init__(self.__d)
|
||||
|
||||
def __doing(self, name):
|
||||
|
@ -40,7 +40,7 @@ class CrudChecker(ClassChecker):
|
||||
frontend.Method,
|
||||
frontend.Property,
|
||||
)
|
||||
config.set_default_env(api.env)
|
||||
#config.set_default_env(api.env)
|
||||
class user(frontend.Object):
|
||||
takes_params = (
|
||||
'givenname',
|
||||
|
@ -764,7 +764,8 @@ class test_Command(ClassChecker):
|
||||
|
||||
# Test in server context:
|
||||
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()
|
||||
o = my_cmd()
|
||||
o.set_api(api)
|
||||
@ -774,7 +775,8 @@ class test_Command(ClassChecker):
|
||||
|
||||
# Test in non-server context
|
||||
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()
|
||||
o = my_cmd()
|
||||
o.set_api(api)
|
||||
@ -907,7 +909,7 @@ class test_Object(ClassChecker):
|
||||
frontend.Method,
|
||||
frontend.Property,
|
||||
)
|
||||
config.set_default_env(api.env)
|
||||
#config.set_default_env(api.env)
|
||||
api.finalize()
|
||||
|
||||
# Test with no primary keys:
|
||||
@ -964,7 +966,7 @@ class test_Object(ClassChecker):
|
||||
frontend.Property,
|
||||
backend.Backend,
|
||||
)
|
||||
config.set_default_env(api.env)
|
||||
#config.set_default_env(api.env)
|
||||
class ldap(backend.Backend):
|
||||
whatever = 'It worked!'
|
||||
api.register(ldap)
|
||||
|
Loading…
Reference in New Issue
Block a user