Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Jinja templates on Windows #10

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion mynt/renderers/jinja.py
Expand Up @@ -13,6 +13,7 @@
from mynt.exceptions import RendererException
from mynt.utils import absurl, normpath

from os.path import sep as pathsep

class _PrefixLoader(PrefixLoader):
def get_source(self, environment, template):
Expand All @@ -33,6 +34,9 @@ def get_source(self, environment, template):
raise TemplateNotFound(template)

try:
if pathsep != '/':
name = name.replace(pathsep, '/')

return loader.get_source(environment, name)
except TemplateNotFound:
raise TemplateNotFound(template)
Expand Down Expand Up @@ -81,7 +85,7 @@ def render(self, template, vars_ = {}):
def setup(self):
self.config.update(self.options)
self.config['loader'] = _PrefixLoader(OrderedDict([
('/', FileSystemLoader(self.path)),
(pathsep, FileSystemLoader(self.path)),
('', FileSystemLoader(normpath(self.path, '_templates')))
]), None)

Expand Down