diff --git a/src/moin/macros/Date.py b/src/moin/macros/Date.py index fe5093a30..a6d422d88 100644 --- a/src/moin/macros/Date.py +++ b/src/moin/macros/Date.py @@ -20,7 +20,7 @@ def parse_time(self, args): Parse a time specification argument for usage by Date and DateTime macro. Not all ISO 8601 format variations are accepted as input. - :param args: float/int UNIX timestamp or null or ISO 8601 formatted date time: + :param args: float/int UNIX timestamp or None or ISO 8601 formatted date time: YYYY-MM-DDTHH:MM:SS (plus optional Z or z for UTC, or +/-HHMM) or YYYY-MM-DD HH:MM:SS (same as above but replacing T separator with " ") :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): tm = self.parse_time(tm) return show_time.format_date(tm) except (AttributeError, OSError, AssertionError, ValueError, OverflowError): - err_msg = _("Invalid input parameter: null, float, int, or ISO 8601 formats are accepted.") + err_msg = _("Invalid input parameter: None, float, int, or ISO 8601 formats are accepted.") return fail_message(err_msg, alternative) diff --git a/src/moin/macros/DateTime.py b/src/moin/macros/DateTime.py index 0bdde12b2..eef916839 100644 --- a/src/moin/macros/DateTime.py +++ b/src/moin/macros/DateTime.py @@ -27,5 +27,5 @@ def macro(self, content, arguments, page_url, alternative): tm = self.parse_time(tm) return show_time.format_date_time(tm) except (AttributeError, OSError, AssertionError, ValueError, OverflowError): - err_msg = _("Invalid input parameter: null, float, int, or ISO 8601 formats are accepted.") + err_msg = _("Invalid input parameter: None, float, int, or ISO 8601 formats are accepted.") return fail_message(err_msg, alternative) diff --git a/src/moin/macros/FontAwesome.py b/src/moin/macros/FontAwesome.py index 71a752505..d1b2455c8 100644 --- a/src/moin/macros/FontAwesome.py +++ b/src/moin/macros/FontAwesome.py @@ -26,12 +26,11 @@ class Macro(MacroInlineBase): def macro(self, content, arguments, page_url, alternative): - args = arguments[0] if arguments else "" - if not args: + if not arguments: err_msg = _("Missing font name, syntax is <>") return fail_message(err_msg, alternative) - args = args.split(",") + args = arguments[0].split(",") fonts = args[0].split() color = args[1].strip() if len(args) > 1 else "" size = args[2].strip() if len(args) > 2 else "" diff --git a/src/moin/macros/_base.py b/src/moin/macros/_base.py index 248a132c8..2eb3db5ad 100644 --- a/src/moin/macros/_base.py +++ b/src/moin/macros/_base.py @@ -95,10 +95,7 @@ def fail_message(msg, alternative, severity="error"): :returns: formatted text of macro, error message """ if severity not in "attention caution danger error hint important note tip".split(): - severity = "error" - msg = ( - _("Invalid severity, must be one of: ") + "attention, caution, danger, error, hint, important, note, or tip" - ) + raise ValueError altern = html.p(children=[html.strong(children=[alternative])]) message = html.p(children=[msg])