From 758c6405614462faf68b34dc3ae23f40464da4bb Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 18 Apr 2019 19:53:21 -0700 Subject: Rename debug to verbose in all relevant places --- onionshare/__init__.py | 8 ++++---- onionshare/common.py | 8 ++++---- onionshare/web/web.py | 8 ++++---- onionshare_gui/__init__.py | 8 ++++---- tests/test_onionshare_common.py | 2 +- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/onionshare/__init__.py b/onionshare/__init__.py index db97f46d..248ab68c 100644 --- a/onionshare/__init__.py +++ b/onionshare/__init__.py @@ -61,7 +61,7 @@ def main(cwd=None): parser.add_argument('--stealth', action='store_true', dest='stealth', help=strings._("help_stealth")) parser.add_argument('--receive', action='store_true', dest='receive', help=strings._("help_receive")) parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config')) - parser.add_argument('--debug', action='store_true', dest='debug', help=strings._("help_debug")) + parser.add_argument('-v', '--verbose', action='store_true', dest='verbose', help=strings._("help_verbose")) parser.add_argument('filename', metavar='filename', nargs='*', help=strings._('help_filename')) args = parser.parse_args() @@ -70,7 +70,7 @@ def main(cwd=None): filenames[i] = os.path.abspath(filenames[i]) local_only = bool(args.local_only) - debug = bool(args.debug) + verbose = bool(args.verbose) stay_open = bool(args.stay_open) autostart_timer = int(args.autostart_timer) autostop_timer = int(args.autostop_timer) @@ -108,8 +108,8 @@ def main(cwd=None): # Re-load the strings, in case the provided config has changed locale strings.load_strings(common) - # Debug mode? - common.debug = debug + # Verbose mode? + common.verbose = verbose # Create the Web object web = Web(common, False, mode) diff --git a/onionshare/common.py b/onionshare/common.py index 02668507..325f11d4 100644 --- a/onionshare/common.py +++ b/onionshare/common.py @@ -36,8 +36,8 @@ class Common(object): """ The Common object is shared amongst all parts of OnionShare. """ - def __init__(self, debug=False): - self.debug = debug + def __init__(self, verbose=False): + self.verbose = verbose # The platform OnionShare is running on self.platform = platform.system() @@ -57,9 +57,9 @@ class Common(object): def log(self, module, func, msg=None): """ - If debug mode is on, log error messages to stdout + If verbose mode is on, log error messages to stdout """ - if self.debug: + if self.verbose: timestamp = time.strftime("%b %d %Y %X") final_msg = "[{}] {}.{}".format(timestamp, module, func) diff --git a/onionshare/web/web.py b/onionshare/web/web.py index 7ce87108..adadf7d4 100644 --- a/onionshare/web/web.py +++ b/onionshare/web/web.py @@ -51,9 +51,9 @@ class Web(object): template_folder=self.common.get_resource_path('templates')) self.app.secret_key = self.common.random_string(8) - # Debug mode? - if self.common.debug: - self.debug_mode() + # Verbose mode? + if self.common.verbose: + self.verbose_mode() # Are we running in GUI mode? self.is_gui = is_gui @@ -193,7 +193,7 @@ class Web(object): self.slug = self.common.build_slug() self.common.log('Web', 'generate_slug', 'built random slug: "{}"'.format(self.slug)) - def debug_mode(self): + def verbose_mode(self): """ Turn on debugging mode, which will log flask errors to a debug file. """ diff --git a/onionshare_gui/__init__.py b/onionshare_gui/__init__.py index 675bb52d..828d5ee3 100644 --- a/onionshare_gui/__init__.py +++ b/onionshare_gui/__init__.py @@ -81,7 +81,7 @@ def main(): # Parse arguments parser = argparse.ArgumentParser(formatter_class=lambda prog: argparse.HelpFormatter(prog,max_help_position=48)) parser.add_argument('--local-only', action='store_true', dest='local_only', help=strings._("help_local_only")) - parser.add_argument('--debug', action='store_true', dest='debug', help=strings._("help_debug")) + parser.add_argument('-v', '--verbose', action='store_true', dest='verbose', help=strings._("help_verbose")) parser.add_argument('--filenames', metavar='filenames', nargs='+', help=strings._('help_filename')) parser.add_argument('--config', metavar='config', default=False, help=strings._('help_config')) args = parser.parse_args() @@ -98,10 +98,10 @@ def main(): strings.load_strings(common) local_only = bool(args.local_only) - debug = bool(args.debug) + verbose = bool(args.verbose) - # Debug mode? - common.debug = debug + # Verbose mode? + common.verbose = verbose # Validation if filenames: diff --git a/tests/test_onionshare_common.py b/tests/test_onionshare_common.py index d70f2c0e..f975dce7 100644 --- a/tests/test_onionshare_common.py +++ b/tests/test_onionshare_common.py @@ -268,7 +268,7 @@ class TestLog: def dummy_func(): pass - common_obj.debug = True + common_obj.verbose = True # From: https://stackoverflow.com/questions/1218933 with io.StringIO() as buf, contextlib.redirect_stdout(buf): -- cgit v1.2.3-54-g00ecf