Request: if 'in' operator

10 views
Skip to first unread message

al james

unread,
Jun 3, 2009, 1:38:26 PM6/3/09
to H2o template PHP
Hi there...

Just thinking that an 'in' operator would be very useful for the for
block.

E.g.

{% if value in values %}
In the list!
{% else %}
Not in the list!
{% endif %}

What do you think?

Charlie Madison

unread,
Jun 3, 2009, 1:46:02 PM6/3/09
to h2o-temp...@googlegroups.com
I think it would be good to have a collection of filters that match
the most requested django ones. And the ones at these 3 links. It's on
my list for some day.

http://docs.djangoproject.com/en/dev/ref/templates/builtins/
http://docs.djangoproject.com/en/dev/ref/contrib/#ref-contrib-markup
http://docs.djangoproject.com/en/dev/ref/contrib/humanize/#ref-contrib-humanize

tai loi luk

unread,
Jun 3, 2009, 10:49:44 PM6/3/09
to h2o-temp...@googlegroups.com
Improving the if_tag is on the way,
=========================

rather than implementing a complex expression parser, i will keep the
current simple implementation but adding the concept of tests,

These are just some examples i can think of, feel free to provide
suggestions on this

{% if variable is boolean %}

{% if list contains item %}

{% if "something" matches "some" %}


Filter improvement
===============
Django contains large amount of filters, H2o currently supports a
subset of them and filter are one area been lacking a bit, since
mostly i use a lot of filters from StringFilters and UrlFilters classes.

If there are a filter very useful filters for you and h2o doesn't
support yet, please add to this feature request wiki page. if you are
curious how to implement them then fork h2o -> add a new filter and
send me a pull request on github



http://wiki.github.com/speedmax/h2o-php/feature-request

al james

unread,
Jun 4, 2009, 6:34:23 PM6/4/09
to H2o template PHP
Improved if tag sounds good! I was trying to work out how to add a
operator to the existing if tag code, but could not!

To be honest, I agree that django suffers from 'feature bloat' and
that h2o should keep it light and simple (yet extensible)....
Reply all
Reply to author
Forward
0 new messages