mustache template variables with dot fail to 'render' #141

Closed
akkumar opened this Issue Jan 4, 2013 · 4 comments

Comments

Projects
None yet
2 participants

akkumar commented Jan 4, 2013

Eg:


>>> mydict
{'catalina_home': '/opt/software/tomcat7', 'catalina.home': '/opt/software/tomcat7'}
>>> pystache.render('Hello {{catalina.home}}', mydict)
u'Hello '

Not sure if this is a limitation / against the mustache template language grammar or
an issue with pystache implementation.

Collaborator

cjerdonek commented Jan 4, 2013

It's not a limitation but a feature. 😀 The latest versions of Pystache support "dot notation" which you can read about here, for example.

cjerdonek closed this Jan 4, 2013

akkumar commented Jan 4, 2013

So , I installed pystache 0.5.3 , using

# pip install pystache 

on my Ubuntu box. Seems to bring in 0.5.3 .

When you mean "latest versions of pystache support dot notation" , where can I get the ones that support it ( may be the github master ? ) . Any publicly available package for the same.

Collaborator

cjerdonek commented Jan 4, 2013

You can see in the HISTORY file that support for dot notation was added in version 0.5.2. Note: "support for dot notation" means that dots have special meaning. In other words, in version 0.5.2 onwards you are not allowed to have a plain tag/key name with a dot in it; a dot results in special behavior described in the link I referenced above.

akkumar commented Jan 4, 2013

Thanks, chris.

Dot notation is well-supported in 0.5.3 pystache as well.

It requires a different dictionary structure with the dot notation though. FYI, for reference:


>>> mydict
{'catalina': {'home': '/opt/software/tomcat7'} }
>>> pystache.render('Hello {{catalina.home}}', mydict)
u'Hello /opt/software/tomcat7'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment