Question

How can I find out the number of parameters (if any at all) that were passed in.

I'm using Mako and I'm calling the template function with:

${article_util.small_article_popular(c.footer_popular_articles[0])}

Within the template:

<%def name="small_article_popular(article)">

// check to see if any parameters were passed in

</%def>
Was it helpful?

Solution

Well small_article_popular(article) is effectively a Python function, so it cannot be called with no parameters, as per the signature. If you want to check if article is None, then just do that.. if article:.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top