Discussion:
Predicate examples?
Lucio
2010-02-26 23:29:23 UTC
Permalink
Hi all,

Can anyone point me to examples on how to create predicates in Python?

I couldn't find anything relevant in either the documentation or the
tests at http://chubot.org/json-template/test-cases/.

thanks,
--lucio
--
You received this message because you are subscribed to the Google Groups "JSON Template" group.
To post to this group, send email to json-template-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to json-template+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/json-template?hl=en.
Andy Chu
2010-02-27 04:26:11 UTC
Permalink
Post by Lucio
Hi all,
Can anyone point me to examples on how to create predicates in Python?
I couldn't find anything relevant in either the documentation or the
tests at http://chubot.org/json-template/test-cases/.
There are a examples there -- if you search for "predicate" in the link titels.

That's basically half of it -- the template -- if you want to see the
other half (the code), see here:

http://code.google.com/p/json-template/source/browse/jsontemplate_test.py

and here: http://code.google.com/p/json-template/source/browse/python/jsontemplate/jsontemplate_unittest.py

The basic idea is that a predicate is an uninterpreted string. To
define your own predicates, pass the more_predicates= arg to the
Template constructor.

The value can either be a plain dictionary from string to function, or
a "FunctionRegistry". The FunctionRegistry gives you a little more
control.

If there are any troubles let me know. Also if anyone wants to help
with the docs, I could give you wiki access.

Andy
--
You received this message because you are subscribed to the Google Groups "JSON Template" group.
To post to this group, send email to json-template-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
To unsubscribe from this group, send email to json-template+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit this group at http://groups.google.com/group/json-template?hl=en.
Loading...