commit:     5a578e55ba2cf6d99abedc2103e432631fccd2db
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 16 18:24:24 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Tue Sep 16 18:24:24 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=5a578e55

argparser.py: Fixes default override of storage config option

---
 layman/argsparser.py | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/layman/argsparser.py b/layman/argsparser.py
index aa8c291..9c29b47 100644
--- a/layman/argsparser.py
+++ b/layman/argsparser.py
@@ -323,6 +323,20 @@ class ArgsParser(BareConfig):
 
     def __getitem__(self, key):
 
+        if key == 'storage':
+            storage = ''
+            if (key in self.options.keys()
+                and not self.options[key] is None):
+                storage = self.options[key]
+            if self.config.has_option('MAIN', 'storage'):
+                storage = self.config.get('MAIN', 'storage')
+            # Set the value to the command line value if and only
+            # if it isn't the same as the default.
+            if self.options[key] != self.defaults[key]:
+                storage = self.options[key]
+            if storage:
+                return storage
+                
         if key == 'overlays':
             overlays = ''
             if (key in self.options.keys()

Reply via email to