defunkt/pystache — Issue #41: View class should allow one to specify the template file path
Author: cjerdonek
Created: 2011-11-27 20:31:34+00:00
State: open

It seems like the View class should allow one to specify the path to the view's template file directly.

Currently, the only way to do this is to strip the extension from the file name and set this as the View instance's template_name, and then include the file's directory in a list of template directories and set this as the View instance's template_path, which seems more awkward than it needs to be.

Of course, the other way is to load the template yourself and pass it as a string, but this is also less convenient.

Related to this, the View class's template_path attribute would probably be better named something like template_dirs or template_search_dirs. Indeed, the View class's get_template() method [passes self.template_path](https://github.com/defunkt/pystache/blob/f543efac93b753914a20b9daaf84a51382fba445/pystache/view.py#L48) as Loader.load_template()'s template_dirs parameter:

self.template = Loader().load_template(template_name, self.template_path, encoding=self.template_encoding, extension=self.template_extension)