Closed wichert closed 12 years ago
Thanks again! Fixed in v4.5.19.
Can you upload 4.5.19 to pypi as well?
oops, forgot to bump version in setup.py.
it's ready now
On Sep 6, 2012, at 8:03 AM, Wichert Akkerman wrote:
Can you upload 4.5.19 to pypi as well?
— Reply to this email directly or view it on GitHub.
Seems this change broke something else: the contact.j2 template can now no longer be found. When I run scase I get the following:
Traceback (most recent call last):
File "bin/scase", line 20, in <module>
strange_case.__main__.run()
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/__main__.py", line 185, in run
strange_case(CONFIG)
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/__init__.py", line 154, in strange_case
root_node.generate()
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/nodes/root_folder.py", line 37, in generate
child.generate(self)
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/nodes/file.py", line 20, in generate
self.generate_file(site, self.source_path, target_path)
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/nodes/jinja.py", line 10, in generate_file
content = self.render(site)
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/nodes/jinja.py", line 21, in render
template = Registry.get('jinja_environment').get_template(fix_path(self.source_path))
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 719, in get_template
return self._load_template(name, self.make_globals(globals))
File "/usr/lib/python2.7/dist-packages/jinja2/environment.py", line 693, in _load_template
template = self.loader.load(self, name, globals)
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/support/jinja.py", line 107, in load
source, filename, uptodate = self.get_source(environment, name)
File "/srv/website/src/eggs/StrangeCase-v4.5.19-py2.7.egg/strange_case/support/jinja.py", line 77, in get_source
contents, filename, uptodate = super(YamlFrontMatterLoader, self).get_source(environment, template)
File "/usr/lib/python2.7/dist-packages/jinja2/loaders.py", line 180, in get_source
raise TemplateNotFound(template)
jinja2.exceptions.TemplateNotFound: /srv/website/src/site/contact.j2
the file does exist though:
wichert@code:/srv/website/src$ ls site/
asset contact.j2 index.j2 media portfolio.j2
yikes. I wonder if this is related to the "windows support" fixes that have been coming in recently.
Do you know what version you were using before? The fix_path
function was added in version v4.5.18.
Previous version was 4.5.17.
that version of jinja looks different from mine:
raise TemplateNotFound('{0} in {1}'.format(template, ','.join(self.searchpath)))
searchpath
is a list of paths, and os.getcwd()
is included in that list.
does pip install -U jinja2
fix it?
(oops - make sure to pip install jinja2)
mine is at 2.6, btw
I don't use pip or virtualenv, so pip install doesn't do anything for me. The exact versions I am running are:
Jinja2 = 2.6
Pillow = 1.7.7
PyYAML = 3.10
Pygments = 1.5
StrangeCase = v4.5.19
Unidecode = 0.04.9
misaka = 1.0.2
argh = 0.15.1
buildout-versions = 1.7
markdown2 = 1.4.2
misaka = 1.0.2
pathtools = 0.1.2
python-dateutil = 2.1
setuptools = 0.6c11
six = 1.1.0
watchdog = 0.6.0
z3c.recipe.scripts = 1.0.1
zc.buildout = 1.5.2
zc.recipe.egg = 1.3.2
There does appear to be an OS-installed jinja first in the path, but that also happens to be version 2.6 (as included in Ubuntu 12.04 precise).
Your jinja must be a different version. You can see the code from the 2.6 release as you can see in the jinja2 git tag for 2.6.
Well I'll be damned. So I was. That's not very nice of me.
Pushed v4.5.20. Adds '/'
to the jinja2 search paths.
(and on pypi)
Thanks, that indeed fixes it.
yay! thanks for your patience.
I had a file named
contact.html
, but all links to it were rendered ascontac
which was a bit unexpected. This turns out to be due to the use of rstrip:rstrip probably does not do what you were expecting: it looks for all characters in the supplied string, it does not look for the string itself. I suggest using a standard slicing: