Rev 6095: Clarify get_default. in file:///home/vila/src/bzr/experimental/convert-default-values/
Vincent Ladeuil
v.ladeuil+lp at free.fr
Mon Aug 22 16:15:31 UTC 2011
At file:///home/vila/src/bzr/experimental/convert-default-values/
------------------------------------------------------------
revno: 6095
revision-id: v.ladeuil+lp at free.fr-20110822161530-0fjr0b9ddioyru26
parent: v.ladeuil+lp at free.fr-20110822141536-70v01odqnwyc08qt
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: convert-default-values
timestamp: Mon 2011-08-22 18:15:30 +0200
message:
Clarify get_default.
-------------- next part --------------
=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py 2011-08-22 14:15:36 +0000
+++ b/bzrlib/config.py 2011-08-22 16:15:30 +0000
@@ -2371,12 +2371,18 @@
return converted
def get_default(self):
+ value = None
for var in self.default_from_env:
try:
- return os.environ[var]
+ # If the env variable is defined, its value is the default one
+ value = os.environ[var]
+ break
except KeyError:
continue
- return self.default
+ if value is None:
+ # Otherwise, fallback to the value defined at registration
+ value = self.default
+ return value
def get_help_text(self, additional_see_also=None, plain=True):
result = self.help
More information about the bazaar-commits
mailing list