Skip to content

template with many parameters #62

Discussion options

You must be logged in to vote

Please use as below
Template:

{% block %}
    {% client %}(?P<nomoruang>.*) (?P<mata1>.*) (berapa) (?P<mata2>.*){% endclient %}
    {% response %}{% call f_duid_converter: %nomoruang %}{% endresponse %}
{% endblock %}

python code:

@register_call("f_duid_converter")
def f_duid_converter(session, nomoruang):
    from currency_converter import CurrencyConverter
    c = CurrencyConverter()
    data = session.attr['match'].groupdict()
    hasliuang = c.convert(nomoruang, data['mata1'], data['mata2'])
    return hasliuang

As of now only one parameter can be passed to function from template but you can get all match group data as dict using session.attr['match'].groupdict().
we are working on …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fadhil-riyanto
Comment options

Answer selected by ahmadfaizalbh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants