summaryrefslogtreecommitdiff
path: root/src/markupsafe/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/markupsafe/__init__.py')
-rw-r--r--src/markupsafe/__init__.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py
index 048ddb8..d1bf187 100644
--- a/src/markupsafe/__init__.py
+++ b/src/markupsafe/__init__.py
@@ -102,9 +102,14 @@ class Markup(str):
def __mod__(self, arg: t.Any) -> "Markup":
if isinstance(arg, tuple):
+ # a tuple of arguments, each wrapped
arg = tuple(_MarkupEscapeHelper(x, self.escape) for x in arg)
- else:
+ elif hasattr(type(arg), "__getitem__") and not isinstance(arg, str):
+ # a mapping of arguments, wrapped
arg = _MarkupEscapeHelper(arg, self.escape)
+ else:
+ # a single argument, wrapped with the helper and a tuple
+ arg = (_MarkupEscapeHelper(arg, self.escape),)
return self.__class__(super().__mod__(arg))