On 08/08/14 11:04, Matthew Booth wrote:
> On 07/08/14 18:54, Kevin L. Mitchell wrote:
>> On Thu, 2014-08-07 at 17:46 +0100, Matthew Booth wrote:
In any case, the operative point is that CONF. must
>>> always be
evaluated inside run-time code, never at module load time.
>>>
>>> ...unless y
On 07/08/14 19:02, Kevin L. Mitchell wrote:
> On Thu, 2014-08-07 at 17:41 +0100, Matthew Booth wrote:
>> ... or arg is an object which defines __nonzero__(), or defines
>> __getattr__() and then explodes because of the unexpected lookup of a
>> __nonzero__ attribute. Or it's False (no quotes when p
On 07/08/14 18:54, Kevin L. Mitchell wrote:
> On Thu, 2014-08-07 at 17:46 +0100, Matthew Booth wrote:
>>> In any case, the operative point is that CONF. must
>> always be
>>> evaluated inside run-time code, never at module load time.
>>
>> ...unless you call register_opts() safely, which is what I'
On Thu, Aug 7, 2014 at 12:54 PM, Kevin L. Mitchell <
kevin.mitch...@rackspace.com> wrote:
> On Thu, 2014-08-07 at 17:46 +0100, Matthew Booth wrote:
> > > In any case, the operative point is that CONF. must
> > always be
> > > evaluated inside run-time code, never at module load time.
> >
> > ...un
On Aug 7, 2014, at 12:39 PM, Kevin L. Mitchell
wrote:
> On Thu, 2014-08-07 at 17:27 +0100, Matthew Booth wrote:
>> On 07/08/14 16:27, Kevin L. Mitchell wrote:
>>> On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
A (the?) solution is to register_opts() in foo before importing any
>>>
On Thu, 2014-08-07 at 17:41 +0100, Matthew Booth wrote:
> ... or arg is an object which defines __nonzero__(), or defines
> __getattr__() and then explodes because of the unexpected lookup of a
> __nonzero__ attribute. Or it's False (no quotes when printed by the
> debugger), but has a unicode type
On Thu, 2014-08-07 at 17:46 +0100, Matthew Booth wrote:
> > In any case, the operative point is that CONF. must
> always be
> > evaluated inside run-time code, never at module load time.
>
> ...unless you call register_opts() safely, which is what I'm
> proposing.
No, calling register_opts() at a
On Thu, 2014-08-07 at 17:44 +0100, Matthew Booth wrote:
> These are tricky, case-by-case workarounds to a general problem which
> can be solved by simply calling register_opts() in a place where it's
> guaranteed to be safe.
No, THE CODE IS WRONG. It is evaluating a configuration value at
_modul
On 07/08/14 17:39, Kevin L. Mitchell wrote:
> On Thu, 2014-08-07 at 17:27 +0100, Matthew Booth wrote:
>> On 07/08/14 16:27, Kevin L. Mitchell wrote:
>>> On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
A (the?) solution is to register_opts() in foo before importing any
modules whic
On 07/08/14 17:34, Dan Smith wrote:
>> That's different behaviour, because you can no longer pass arg=None. The
>> fix isn't to change the behaviour of the code.
>
> So use a sentinel...
That would also be a change to the behaviour of the code, because you
can no longer pass in the sentinel.
The
On 07/08/14 17:11, Kevin L. Mitchell wrote:
> On Thu, 2014-08-07 at 10:55 -0500, Matt Riedemann wrote:
>>
>> On 8/7/2014 10:27 AM, Kevin L. Mitchell wrote:
>>> On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
A (the?) solution is to register_opts() in foo before importing any
modul
On Thu, 2014-08-07 at 17:27 +0100, Matthew Booth wrote:
> On 07/08/14 16:27, Kevin L. Mitchell wrote:
> > On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
> >> A (the?) solution is to register_opts() in foo before importing any
> >> modules which might also use oslo.config.
> >
> > Actually
> That's different behaviour, because you can no longer pass arg=None. The
> fix isn't to change the behaviour of the code.
So use a sentinel...
--Dan
signature.asc
Description: OpenPGP digital signature
___
OpenStack-dev mailing list
OpenStack-dev@l
On 07/08/14 16:27, Kevin L. Mitchell wrote:
> On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
>> A (the?) solution is to register_opts() in foo before importing any
>> modules which might also use oslo.config.
>
> Actually, I disagree. The real problem here is the definition of
> bar_func
On Thu, 2014-08-07 at 10:55 -0500, Matt Riedemann wrote:
>
> On 8/7/2014 10:27 AM, Kevin L. Mitchell wrote:
> > On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
> >> A (the?) solution is to register_opts() in foo before importing any
> >> modules which might also use oslo.config.
> >
> > Ac
On 8/7/2014 10:27 AM, Kevin L. Mitchell wrote:
On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
A (the?) solution is to register_opts() in foo before importing any
modules which might also use oslo.config.
Actually, I disagree. The real problem here is the definition of
bar_func().
On Thu, 2014-08-07 at 12:15 +0100, Matthew Booth wrote:
> A (the?) solution is to register_opts() in foo before importing any
> modules which might also use oslo.config.
Actually, I disagree. The real problem here is the definition of
bar_func(). The default value of the parameter "arg" will lik
On 07/08/14 12:15, Matthew Booth wrote:
> I'm sure this is well known, but I recently encountered this problem for
> the second time.
>
> ---
> foo:
> import oslo.config as cfg
>
> import bar
>
> CONF = cfg.CONF
> CONF.register_opts('foo_opt')
>
> ---
> bar:
> import oslo.config as cfg
>
> CON
I'm sure this is well known, but I recently encountered this problem for
the second time.
---
foo:
import oslo.config as cfg
import bar
CONF = cfg.CONF
CONF.register_opts('foo_opt')
---
bar:
import oslo.config as cfg
CONF = cfg.CONF
def bar_func(arg=CONF.foo_opt):
pass
---
importing foo re
19 matches
Mail list logo