[tor-commits] [bridgedb/master] Get rid of bridgedb.Main.CONFIG_DEFAULTS dict.

isis at torproject.org isis at torproject.org
Sun Jan 12 06:06:31 UTC 2014


commit 1ef4e2a4bda2fae26adc74b540facaa221611412
Author: Isis Lovecruft <isis at torproject.org>
Date:   Tue Nov 5 05:22:46 2013 +0000

    Get rid of bridgedb.Main.CONFIG_DEFAULTS dict.
    
     * REMOVE dictionary bridgedb.Main.CONFIG_DEFAULTS of config settings. These
       are already set, so I don't know why they should be duplicated here.
    
     * REMOVE method bridgedb.Main.Conf.setMissing(), which did nothing except for
       set the config items to the settings from the above mentioned dict if they
       were missing.
---
 lib/bridgedb/Main.py |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/lib/bridgedb/Main.py b/lib/bridgedb/Main.py
index 5701681..b196bc5 100644
--- a/lib/bridgedb/Main.py
+++ b/lib/bridgedb/Main.py
@@ -28,24 +28,11 @@ import bridgedb.Util as Util
 
 
 class Conf:
-    """A configuration object.  Holds unvalidated attributes.
-    """
+    """A configuration object.  Holds unvalidated attributes."""
     def __init__(self, **attrs):
-        self.__dict__.update(attrs)
-        self.setMissing()
-
-    def setMissing(self):
-        for k,v in CONFIG_DEFAULTS.items():
-            if not hasattr(self, k):
-                setattr(self,k,v)
-
-CONFIG_DEFAULTS = {
-    'HTTPS_INCLUDE_FINGERPRINTS' : False,
-    'EMAIL_INCLUDE_FINGERPRINTS' : False,
-    'RECAPTCHA_ENABLED' : False,
-    'RECAPTCHA_PUB_KEY' : "",
-    'RECAPTCHA_PRIV_KEY' : ""
-}
+        for key, value in attrs.items():
+            if key.upper() == key:
+                self.__dict__[key] = value
 
 # An example configuration.  Used for testing.  See sample
 # bridgedb.conf for documentation.





More information about the tor-commits mailing list