defunkt/pystache

Do not call methods on strings

Closed this issue · 0 comments

See the comment for this commit by @schallis:

Removed the ability to call methods on strings

Whilst the ability to revert to calling getattr() on an arbitrary object can
be useful, this can cause problems when the intended variable appears later in
the context than an object with a similarly named attribute.

For example, take the following context:

['The cat sat on the mat', {'count': 5, 'color': "blue"}]

In this instance, calling {{count}} in the template would return the count
method of the string which is not what we intended.