[PATCH][BUG] BZR_PLUGIN_PATH='' loads from ~/.bzr.conf/plugins

Harald Meland harald.meland at usit.uio.no
Mon Jun 27 16:48:46 BST 2005


[Aaron Bentley]

> John A Meinel wrote:
>> Harald Meland wrote:
>> 
>>> Isn't this merely a verbose way of saying:
>>>
>>>  bzrpath = os.environ.get('BZR_PLUGIN_PATH', DEFAULT_PLUGIN_PATH)
>>>
>>> ?
>>>
>>>
>> That is what I thought, but that is how I had it, and Martin changed it.
>> So I left it the way he had it, and just fixed the if statement.
>
> There is actually a slight difference.  Doing
> os.environ.get('BZR_PLUGIN_PATH', None) means that if 'BZR_PLUGIN_PATH'
> is defined, and its value is set to None, the result is the same as when
> 'BZR_PLUGIN_PATH' is not defined.

Keep in mind that we're not talking of any old dict here.

I think os.environ is kinda special in that all its values are
(initially, i.e. when the "os" module is first imported) strings:

  $ foo="" python -c 'import os; print repr(os.environ.get("foo"))'
  ''

This leads me to suspect that it would only contain e.g. a None-value
if client code explicitly assigned such a value into the mapping (and
this wasn't stopped by a putenv() exception).

Note, though, that I have no experience with Python on windows; things
might be different there.
-- 
Harald




More information about the bazaar mailing list