Comment #2 on issue 32 by [email protected]: Formatters (and predicates)
should be passed a stack of namespaces, rather than a single one
http://code.google.com/p/json-template/issues/detail?id=32
Note: This is a little problematic for compatibility. The 'html' formatter
is:
def HtmlEscape(s): # s is a string from the JSON
return cgi.escape(s)
If you need any other variables, it would have to be:
def HtmlEscape(context):
DoSomethingWith(context.Lookup('other-name'))
return cgi.escape(context.Lookup('@'))
Might have to distinguish between the 2 kinds of formatters/predicates.
{@|html}
{relative-url|$format-with-base-url}
Not sure I like $. Likewise for the Plural predicate -- it may need to
take an
integer as well as a context.
Another possibility is to distinguish formatters/predicates on atoms
(strings,
numbers, bools) vs formatters/predicates on composites (lists,
dictionaries).
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JSON
Template" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/json-template?hl=en
-~----------~----~----~----~------~----~------~--~---