Skip to content

Commit 245e7c3

Browse files
committed
Don't suck at Boolean logic in perror()
- Fix error reporting to correctly set options.report_errors in delete to mean what it says it means - Do not invert the defintion of "maybe" in perror (undelete, delete) (Trac: #1568)
1 parent c70dde8 commit 245e7c3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

delete

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def perror(message, **kwargs):
4747
Format an error message, log it in the debug log
4848
and maybe also print it to stderr.
4949
"""
50-
should_print = not kwargs.pop('_maybe', False)
50+
should_print = kwargs.pop('_maybe', False)
5151
msg = "{0}: {1}".format(whoami, message.format(**kwargs))
5252
logger.debug("Error: %s", msg)
5353
if should_print:
@@ -176,7 +176,7 @@ def main():
176176
parser.error("-r and -D are mutually exclusive")
177177
if len(args) < 1:
178178
parser.error("No files or directories specified.")
179-
options.report_errors = not options.emulate_rm or not options.force
179+
options.report_errors = not (options.emulate_rm or options.force)
180180
errors = 0
181181
for filename in args:
182182
# Because you know _someone_ will try it

undelete

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def perror(message, **kwargs):
4545
Format an error message, log it in the debug log
4646
and maybe also print it to stderr.
4747
"""
48-
should_print = not kwargs.pop('_maybe', False)
48+
should_print = kwargs.pop('_maybe', False)
4949
msg = "{0}: {1}".format(whoami, message.format(**kwargs))
5050
logger.debug("Error: %s", msg)
5151
if should_print:

0 commit comments

Comments
 (0)