Skip to content

Commit

Permalink
added ability to provide a path to a template file
Browse files Browse the repository at this point in the history
  • Loading branch information
jgstew committed Mar 10, 2020
1 parent 17a5dfd commit 6b0970c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pystache/renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import sys
import os

from pystache import defaults
from pystache.common import TemplateNotFoundError, MissingTags, is_string
Expand Down Expand Up @@ -450,6 +451,8 @@ def render(self, template, *context, **kwargs):
all items in the *context list.
"""
if is_string(template) and os.path.isfile(template) and os.access(template, os.R_OK):
return self.render_path(self, template, *context, **kwargs)
if is_string(template):
return self._render_string(template, *context, **kwargs)
if isinstance(template, ParsedTemplate):
Expand Down

0 comments on commit 6b0970c

Please sign in to comment.