Hi, Patch for #1549 and #1550 (and all others where command line option name is different from attribute name).
As discussed before, this is least evil implementation. Other approaches force substantially noticeable performance degradation or API changes that prevent from re-using memoized API.txt. See following threads on freeipa-devel@ for references: https://www.redhat.com/archives/freeipa-devel/2011-August/msg00000.html https://www.redhat.com/archives/freeipa-devel/2011-August/msg00011.html -- / Alexander Bokovoy
From d11e876f59da5275e1d8d0afece7adbc7535dedb Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy <[email protected]> Date: Wed, 17 Aug 2011 15:46:41 +0300 Subject: [PATCH] Propagate environment when it is required. https://fedorahosted.org/freeipa/ticket/1549 https://fedorahosted.org/freeipa/ticket/1550 --- ipalib/frontend.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/ipalib/frontend.py b/ipalib/frontend.py index 35343105c214bf00f7e34db5870437821fecd869..1f9f172e1735613fe717997daf8af7fe5d3e2a4f 100644 --- a/ipalib/frontend.py +++ b/ipalib/frontend.py @@ -344,6 +344,13 @@ class HasParam(Plugin): for spec in get(): param = create_param(spec) if env is None or param.use_in_context(env): + if env is not None and not hasattr(param, 'env'): + # Force specified environment. The way it is done is violation of ReadOnly promise. + # Unfortunately, all alternatives are worse from both performance and code complexity + # points of view. See following threads on freeipa-devel@ for references: + # https://www.redhat.com/archives/freeipa-devel/2011-August/msg00000.html + # https://www.redhat.com/archives/freeipa-devel/2011-August/msg00011.html + object.__setattr__(param, 'env', env) yield param def _create_param_namespace(self, name, env=None): -- 1.7.6
_______________________________________________ Freeipa-devel mailing list [email protected] https://www.redhat.com/mailman/listinfo/freeipa-devel
