[tor-commits] [oonib/master] Merge branch 'master' of github.com:TheTorProject/ooni-backend

art at torproject.org art at torproject.org
Wed Apr 23 14:31:52 UTC 2014


commit 873b193ad40a625e58cdf3004600d0e40d61ac6c
Merge: 0148e99 207e4b0
Author: Arturo Filastò <art at fuffa.org>
Date:   Mon Apr 21 19:39:37 2014 +0200

    Merge branch 'master' of github.com:TheTorProject/ooni-backend
    
    * 'master' of github.com:TheTorProject/ooni-backend:
      If p is a dictionary (as I assume) then you don't need the .keys().
      Avoid the possibility of accidentally sharing the same mutable list for self.input and self.nettest.
      Most of the body of this doesn't need to be in the scope of the 'with'. (This comes up in lots of the other 'with's in this codebase.)
      More-direct code for validateNettest, as long as I'm messing with it. You could do the same to validateInputHash.
      Make validateNettest work like validateInputHash. Previously the code was clearly redundant and thus probably wrong.
      Export ssl_helpers. (Or was it meant to be left out?)
      Load the bouncer file just once. The previous code read it twice, which could create inconsistent datastructures if the file got edited at the wrong time.
      Fix: old code could raise a KeyError because choices[c] preceded the if c in choices
      Check version semantically instead of by string (the old code answers wrong for '0.10.0').
      fix 'false midnight' bug (https://lwn.net/Articles/590299/ for an explanation)
      Apply the correct regular expression to the test helper key.
      Make the CC regexp also more accurate
      Add $ to the end of regexps that should have it
      Remove unused duplicate of updateKnownHelpers
      Fix InvalidArchiveDirectory exception message
    
    Conflicts:
    	oonib/bouncer/handlers.py
    	oonib/config.py

 oonib/config.py |   11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --cc oonib/config.py
index 1388e6b,956fcc1..f0fc071
--- a/oonib/config.py
+++ b/oonib/config.py
@@@ -37,14 -39,17 +37,11 @@@ class Config(object)
          self.check_paths()
      
      def check_paths(self):
-         def check_path(directory, complaint):
-             if not (directory and os.path.isdir(directory)):
-                 raise complaint(directory)
-         check_path(self.main.report_dir,  e.InvalidReportDirectory)
-         check_path(self.main.archive_dir, e.InvalidArchiveDirectory)
-         check_path(self.main.input_dir,   e.InvalidInputDirectory)
-         check_path(self.main.deck_dir,    e.InvalidDeckDirectory)
+         if not self.main.report_dir or not os.path.isdir(self.main.report_dir):
+             raise e.InvalidReportDirectory(self.main.report_dir)
+         if not self.main.archive_dir or not os.path.isdir(self.main.archive_dir):
+             raise e.InvalidArchiveDirectory(self.main.archive_dir)
  
 -        if self.main.input_dir and not os.path.isdir(self.main.input_dir):
 -            raise e.InvalidInputDirectory(self.main.input_dir)
 -        if self.main.deck_dir and not os.path.isdir(self.main.deck_dir):
 -            raise e.InvalidDeckDirectory(self.main.deck_dir)
 -
  backend_version = __version__
 -reports = {}
  
  config = Config()





More information about the tor-commits mailing list