Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

TemplateSpec should let one specify the template file path #41

Closed
cjerdonek opened this Issue Nov 27, 2011 · 1 comment

Comments

Projects
None yet
1 participant
Collaborator

cjerdonek commented Nov 27, 2011

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--

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

as Loader.load_template()'s template_dirs parameter:

def load_template(self, template_name, template_dirs=None, encoding=None, extension=None):

cjerdonek added a commit to cjerdonek/pystache that referenced this issue Oct 17, 2012

cjerdonek added a commit to cjerdonek/pystache that referenced this issue Oct 17, 2012

Merge branch 'issue-41' into development: address issue #41.
This adds a template_path attribute to TemplateSpec which lets one specify
an absolute path to the associated template file.
Collaborator

cjerdonek commented Oct 17, 2012

Committed to development.

@cjerdonek cjerdonek closed this Oct 17, 2012

cjerdonek added a commit that referenced this issue Oct 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment