public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Brian Dolbec" <brian.dolbec@gmail.com>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/
Date: Tue, 23 Dec 2014 02:50:04 +0000 (UTC)	[thread overview]
Message-ID: <1419302913.d0530210fad7fefead404d07c0af4b57c8f35fca.dol-sen@gentoo> (raw)

commit:     d0530210fad7fefead404d07c0af4b57c8f35fca
Author:     Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 23 02:40:01 2014 +0000
Commit:     Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Tue Dec 23 02:48:33 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=proj/gentoo-keys.git;a=commit;h=d0530210

gkeys/config.py: Fix the config defaults to do % substitution for the defaults

If it did not find and loada valid config file, the defaults did not have the % subtitution applied.
The logger calls were not using the logger setting in the config. So I changed that

---
 gkeys/gkeys/base.py   |  2 +-
 gkeys/gkeys/config.py | 17 +++++++++++------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/gkeys/gkeys/base.py b/gkeys/gkeys/base.py
index 95142f9..a5e3bfa 100644
--- a/gkeys/gkeys/base.py
+++ b/gkeys/gkeys/base.py
@@ -203,7 +203,7 @@ class CliBase(object):
         logger = set_logger('gkeys', self.config['logdir'], args.debug,
             dirmode=int(self.config.get_key('permissions', 'directories'),0),
             filemask=int(self.config.get_key('permissions', 'files'),0))
-        config.logger = logger
+        self.config.logger = logger
         fileops.logger = logger
         seed.logger = logger
         lib.logger = logger

diff --git a/gkeys/gkeys/config.py b/gkeys/gkeys/config.py
index 775ea1f..e6789ff 100644
--- a/gkeys/gkeys/config.py
+++ b/gkeys/gkeys/config.py
@@ -13,6 +13,8 @@
 import os
 import sys
 
+from collections import OrderedDict
+
 # py3.2
 if sys.hexversion >= 0x30200f0:
     import configparser as ConfigParser
@@ -27,7 +29,6 @@ from pyGPG.config import GPGConfig
 from gkeys import log
 from gkeys.utils import path
 
-logger = log.logger
 
 
 # establish the eprefix, initially set so eprefixify can
@@ -60,7 +61,9 @@ class GKeysConfig(GPGConfig):
         """ Class initialiser """
         GPGConfig.__init__(self)
 
+        self.logger = None
         self.root = root or ''
+        self.defaults = OrderedDict(self.defaults)
         if config:
             self.defaults['config'] = config
             self.defaults['configdir'] = os.path.dirname(config)
@@ -115,6 +118,8 @@ class GKeysConfig(GPGConfig):
             # fix the config path
             self.defaults['config'] = self.defaults['config'] \
                 % {'configdir': self.defaults['configdir']}
+        for key in self.defaults:
+            self.defaults[key] = self._sub_(self.defaults[key])
         defaults = self.get_defaults()
         # remove some defaults from being entered into the configparser
         for key in ['gpg_defaults', 'only_usable', 'refetch', 'tasks']:
@@ -130,8 +135,8 @@ class GKeysConfig(GPGConfig):
     def _get_(self, key, subkey=None):
         if subkey:
             if self.configparser and self.configparser.has_option(key, subkey):
-                if logger:
-                    logger.debug("Found %s in configparser... %s"
+                if self.logger:
+                    self.logger.debug("Found %s in configparser... %s"
                         % (key, str(self.configparser.get(key, subkey))))
                 return self._sub_(self.configparser.get(key, subkey))
             #print("CONFIG: key, subkey", key, subkey)
@@ -142,10 +147,10 @@ class GKeysConfig(GPGConfig):
             else:
                 return super(GKeysConfig, self)._get_(key, subkey)
         elif self.configparser and self.configparser.has_option('DEFAULT', key):
-            if logger:
-                logger.debug("Found %s in configparser... %s"
+            if self.logger:
+                self.logger.debug("Found %s in configparser... %s"
                     % (key, str(self.configparser.get('DEFAULT', key))))
-                #logger.debug("type(key)= %s"
+                #self.logger.debug("type(key)= %s"
                 #    % str(type(self.configparser.get('DEFAULT', key))))
             return self.configparser.get('DEFAULT', key)
         else:


             reply	other threads:[~2014-12-23  2:50 UTC|newest]

Thread overview: 144+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-23  2:50 Brian Dolbec [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-08-15 16:15 [gentoo-commits] proj/gentoo-keys:master commit in: gkeys/gkeys/ Brian Dolbec
2018-08-15  1:51 Brian Dolbec
2018-08-15  1:05 Brian Dolbec
2018-07-07 15:10 Brian Dolbec
2018-07-07 15:10 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2018-07-07  5:23 Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-12-24  0:38 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-12-24  0:38 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-10-27 18:41 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  9:13 [gentoo-commits] proj/gentoo-keys:gsoc-2016 " Brian Dolbec
2016-10-27 21:49 ` [gentoo-commits] proj/gentoo-keys:master " Brian Dolbec
2016-12-24  4:52 Brian Dolbec
2016-06-01 15:16 Brian Dolbec
2016-06-01 15:16 Brian Dolbec
2016-01-23 23:33 Brian Dolbec
2016-01-23 23:33 Brian Dolbec
2016-01-23 19:04 Brian Dolbec
2015-12-25 17:03 Brian Dolbec
2015-12-13  0:51 Brian Dolbec
2015-08-25 14:10 Brian Dolbec
2015-08-25 14:10 Brian Dolbec
2015-08-09 22:52 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-08-09  1:09 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-07-25 16:45 Brian Dolbec
2015-06-22 13:41 Brian Dolbec
2015-06-01  1:56 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-05-31  5:03 Brian Dolbec
2015-03-18 15:32 Brian Dolbec
2015-03-17 19:51 Brian Dolbec
2015-03-08 15:09 Brian Dolbec
2015-03-06 21:04 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-02-11 17:37 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-09 21:07 Brian Dolbec
2015-01-08  4:13 Brian Dolbec
2015-01-07 23:39 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-05 23:12 Brian Dolbec
2015-01-01 22:32 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2015-01-01 17:44 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-31 21:34 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26 18:37 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-26  5:02 Brian Dolbec
2014-12-25 22:07 Brian Dolbec
2014-12-25 22:07 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-25 20:43 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-24 19:59 Brian Dolbec
2014-12-23  2:50 Brian Dolbec
2014-12-23  0:13 Brian Dolbec
2014-12-22 23:11 Brian Dolbec
2014-12-22 23:11 Brian Dolbec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1419302913.d0530210fad7fefead404d07c0af4b57c8f35fca.dol-sen@gentoo \
    --to=brian.dolbec@gmail.com \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox