mintchaos / typogrify

A set of Django template filters to make caring about typography on the web a bit easier.
http://static.mintchaos.com/projects/typogrify/
Other
168 stars 29 forks source link

Typogrify 2.0.5 breaks Pelican installation #33

Closed sscherfke closed 10 years ago

sscherfke commented 10 years ago

I’m using typogrify with pelican. My site used to build with typogrify==2.0.4 but breaks with typogrify==2.0.5.

Pelican gives me the warning unsupported operand type(s) for +: 'map' and 'list' (unfortunately without more details). And later, it all breaks:

Traceback (most recent call last):
  File "/Users/name/venv/bin/pelican", line 11, in <module>
    sys.exit(main())
  File "/Users/name/venv/lib/python3.4/site-packages/pelican/__init__.py", line 419, in main
    pelican.run()
  File "/Users/name/venv/lib/python3.4/site-packages/pelican/__init__.py", line 173, in run
    p.generate_output(writer)
  File "/Users/name/venv/lib/python3.4/site-packages/pelican/generators.py", line 211, in generate_output
    override_output=True)
  File "/Users/name/venv/lib/python3.4/site-packages/pelican/writers.py", line 206, in write_file
    override_output)
  File "/Users/name/venv/lib/python3.4/site-packages/pelican/writers.py", line 154, in _write_file
    output = template.render(localcontext)
  File "/Users/name/venv/lib/python3.4/site-packages/jinja2/environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "/Users/name/venv/lib/python3.4/site-packages/jinja2/environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/name/venv/lib/python3.4/site-packages/jinja2/_compat.py", line 36, in reraise
    raise value.with_traceback(tb)
  File "/Users/stefan/Code/mosaik-website/theme/templates/home.html", line 1, in <module>
    {% extends "base.html" %}
  File "/Users/stefan/Code/mosaik-website/theme/templates/base.html", line 33, in <module>
    {% block content %}{% endblock %}
  File "/Users/stefan/Code/mosaik-website/theme/templates/home.html", line 77, in <module>
    <h2><a href="{{ SITEURL }}/{{ articles[i].url }}" rel="bookmark" title="Permalink to {{ articles[i].title|striptags }}">{{ articles[i].title }}</a></h2>
  File "/Users/name/venv/lib/python3.4/site-packages/jinja2/environment.py", line 397, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: list object has no element 0

I also posted this on the pelican tracker, because I’m not 100% sure who’s to blame here. https://github.com/getpelican/pelican/issues/1456

justinmayer commented 10 years ago

@sscherfke: Please test the fix in #34, which has been merged to Typogrify master.

sscherfke commented 10 years ago

Does not work. It now tries to add the result of two filter() calls and fails. Maybe using list comprehensions instead would solve this.

justinmayer commented 10 years ago

@sscherfke: Would you please test @barrysteyn's fix (#36) and let us know whether it addresses the issue you reported?

sscherfke commented 10 years ago

@justinmayer: It seems to work nicely. Got no errors.

justinmayer commented 10 years ago

Great. Thanks for helping out with testing!

justinmayer commented 10 years ago

Addressed via https://github.com/mintchaos/typogrify/commit/bf9749813c72f58ca8989b737c5da4bff0fe0402 and released as Typogrify 2.0.7.