Skip to main content

stringfilter

Decorator for filters which should only receive strings. The object passed as the first positional argument will be converted to a string.

def stringfilter(
func: callable
) - > function

Decorator for filters which should only receive strings. The object passed as the first positional argument will be converted to a string.

Parameters

NameTypeDescription
funccallableThe filter function to be decorated, which expects a string as its first argument.

Returns

TypeDescription
functionA wrapped version of the original filter function that ensures the first argument is cast to a string and preserves HTML safety markers if applicable.