Skip to content

Commit 3dd24c9

Browse files
authored
Merge pull request #1695 from RogerHaase/1687-macro-traceback
cleanup macros with editing errors should not log tracebacks #1687
2 parents f7e64dd + 006ade5 commit 3dd24c9

File tree

4 files changed

+6
-10
lines changed

4 files changed

+6
-10
lines changed

src/moin/macros/Date.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def parse_time(self, args):
2020
Parse a time specification argument for usage by Date and DateTime macro.
2121
Not all ISO 8601 format variations are accepted as input.
2222
23-
:param args: float/int UNIX timestamp or null or ISO 8601 formatted date time:
23+
:param args: float/int UNIX timestamp or None or ISO 8601 formatted date time:
2424
YYYY-MM-DDTHH:MM:SS (plus optional Z or z for UTC, or +/-HHMM) or
2525
YYYY-MM-DD HH:MM:SS (same as above but replacing T separator with " ")
2626
:returns: UNIX timestamp (UTC) or raises one of AttributeError, OSError, AssertionError, ValueError, OverflowError
@@ -70,5 +70,5 @@ def macro(self, content, arguments, page_url, alternative):
7070
tm = self.parse_time(tm)
7171
return show_time.format_date(tm)
7272
except (AttributeError, OSError, AssertionError, ValueError, OverflowError):
73-
err_msg = _("Invalid input parameter: null, float, int, or ISO 8601 formats are accepted.")
73+
err_msg = _("Invalid input parameter: None, float, int, or ISO 8601 formats are accepted.")
7474
return fail_message(err_msg, alternative)

src/moin/macros/DateTime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def macro(self, content, arguments, page_url, alternative):
2727
tm = self.parse_time(tm)
2828
return show_time.format_date_time(tm)
2929
except (AttributeError, OSError, AssertionError, ValueError, OverflowError):
30-
err_msg = _("Invalid input parameter: null, float, int, or ISO 8601 formats are accepted.")
30+
err_msg = _("Invalid input parameter: None, float, int, or ISO 8601 formats are accepted.")
3131
return fail_message(err_msg, alternative)

src/moin/macros/FontAwesome.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@
2626

2727
class Macro(MacroInlineBase):
2828
def macro(self, content, arguments, page_url, alternative):
29-
args = arguments[0] if arguments else ""
30-
if not args:
29+
if not arguments:
3130
err_msg = _("Missing font name, syntax is <<FontAwesome(name,color,size)>>")
3231
return fail_message(err_msg, alternative)
3332

34-
args = args.split(",")
33+
args = arguments[0].split(",")
3534
fonts = args[0].split()
3635
color = args[1].strip() if len(args) > 1 else ""
3736
size = args[2].strip() if len(args) > 2 else ""

src/moin/macros/_base.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,7 @@ def fail_message(msg, alternative, severity="error"):
9595
:returns: formatted text of macro, error message
9696
"""
9797
if severity not in "attention caution danger error hint important note tip".split():
98-
severity = "error"
99-
msg = (
100-
_("Invalid severity, must be one of: ") + "attention, caution, danger, error, hint, important, note, or tip"
101-
)
98+
raise ValueError
10299

103100
altern = html.p(children=[html.strong(children=[alternative])])
104101
message = html.p(children=[msg])

0 commit comments

Comments
 (0)