--- a/mercurial/registrar.py Mon Mar 19 20:39:06 2018 +0900
+++ b/mercurial/registrar.py Sun Mar 18 15:14:58 2018 +0900
@@ -324,7 +324,7 @@
templatefilter = registrar.templatefilter()
- @templatefilter('myfilter')
+ @templatefilter('myfilter', intype=bytes)
def myfilterfunc(text):
'''Explanation of this template filter ....
'''
@@ -332,6 +332,9 @@
The first string argument is used also in online help.
+ Optional argument 'intype' defines the type of the input argument,
+ which should be (bytes, int, or None for any.)
+
'templatefilter' instance in example above can be used to
decorate multiple functions.
@@ -342,6 +345,9 @@
Otherwise, explicit 'templatefilters.loadkeyword()' is needed.
"""
+ def _extrasetup(self, name, func, intype=None):
+ func._intype = intype
+
class templatefunc(_templateregistrarbase):
"""Decorator to register template function