-
Notifications
You must be signed in to change notification settings - Fork 7
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
Fixed Jinja on Windows (it choked on "\"-paths) #41
Conversation
Added strange_case.support.jinja.fix_path, which is used in StrangeCaseEnvironment.__init__() and JinjaNode.render(). As it says in the docstring: Jinja chokes on backslash-separated paths, and slash-separatd paths work well enough in Windows anyway. See also [Jinja2-99][], [Jinja2-98][]. [Jinja2-98]: pallets/jinja#98 [Jinja2-99]: pallets/jinja#99
God help the person who uses |
Fixed Jinja on Windows (it choked on "\"-paths)
Thanks for all your help on the Windows compatibility! |
Thanks for making the SSG closest to what I'm looking for! (I'd like to start using this at work for some internal documentation, and personally for template-extraction on some legacy websites. Most other SSGs are a bit over-engineered for that other use-case, and I really like Jinja compared to anything available for Ruby.) The only Windows issue I'm aware of now is misaka not building, I can use markdown2 until that's fixed. Oh, and I don't think the code for #36 (4.5.17) ever made it into Master? |
We might have spoken too soon, i'm getting failures after merging this request... 4.5.17 is up, on pypi at least: http://pypi.python.org/pypi/StrangeCase (says "4.5.17") |
I can get the failures fixed by getting rid of diff --git a/strange_case/support/jinja.py b/strange_case/support/jinja.py
index 8c9434c..3f6e3b4 100644
--- a/strange_case/support/jinja.py
+++ b/strange_case/support/jinja.py
@@ -145,5 +146,4 @@ def fix_path(path):
Note: This function will also chomp any in-filename backslashes.
Hopefully you don't have any of those in the relative path to your template.
"""
- return os.path.relpath(path).replace(os.path.sep, '/')
-
+ return path.replace(os.path.sep, '/') |
I"ve pushed v4.5.18, which includes this fix, and passes the tests. Can you verify all-is-well on your end? |
Nope. I was using
|
What about using os.path.abspath instead? any help? On Aug 16, 2012, at 12:09 PM, Ed Brannin wrote:
|
Here are the variables at the top of
It looks like the Jinja environment knows its PWD, and is "helpfully" prepending that to whatever path we give it. The error I pasted above shows an absolute path tacked onto the end of another absolute path. What failure had you experienced? Maybe this will work if we only use |
Note for posterity: this is continuing over at #44. |
Added strange_case.support.jinja.fix_path, which is used in
StrangeCaseEnvironment.init() and JinjaNode.render().
As it says in the docstring:
Jinja chokes on backslash-separated paths, and slash-separatd
paths work well enough in Windows anyway. See also Jinja2-99,
Jinja2-98.