Use duck typing in View#getTemplateData.

Closes gh-349