cmacmackin / backdrop-theme

A responsive Pelican static blog engine theme.
1 stars 5 forks source link

make devserver fails with generated backdrop theme #2

Open delip opened 9 years ago

delip commented 9 years ago

Sorry to barf the error message but hoping you will find this useful in helping me out.

pelican.run()
  File "//anaconda/lib/python2.7/site-packages/pelican/__init__.py", line 181, in run
    p.generate_output(writer)
  File "//anaconda/lib/python2.7/site-packages/pelican/generators.py", line 475, in generate_output
    self.generate_pages(writer)
  File "//anaconda/lib/python2.7/site-packages/pelican/generators.py", line 371, in generate_pages
    self.generate_direct_templates(write)
  File "//anaconda/lib/python2.7/site-packages/pelican/generators.py", line 319, in generate_direct_templates
    page_name=os.path.splitext(save_as)[0])
  File "//anaconda/lib/python2.7/site-packages/pelican/writers.py", line 207, in write_file
    page.save_as, override_output)
  File "//anaconda/lib/python2.7/site-packages/pelican/writers.py", line 148, in _write_file
    output = template.render(localcontext)
  File "//anaconda/lib/python2.7/site-packages/jinja2/environment.py", line 989, in render
    return self.environment.handle_exception(exc_info, True)
  File "//anaconda/lib/python2.7/site-packages/jinja2/environment.py", line 754, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/delip/workspace/site/pelican-theme-backdrop/templates/index.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/Users/delip/workspace/site/pelican-theme-backdrop/templates/base.html", line 92, in top-level template code
    {% block content %}
  File "/Users/delip/workspace/site/pelican-theme-backdrop/templates/index.html", line 6, in block "content"
    {{ macros.article_summary(articles[0],SITEURL,True,disqus=DISQUS_SITENAME) }}
  File "/Users/delip/workspace/site/pelican-theme-backdrop/templates/macros.html", line 26, in template
    {% if showimg and imgside and article.featured_image %}
  File "//anaconda/lib/python2.7/site-packages/jinja2/environment.py", line 408, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: list object has no element 0
cmacmackin commented 9 years ago

Sorry, I think this is an old bug which I'd fixed locally but forgotten to push to GitHub. I'm pretty sure the error occurred because you had no articles in your site. It used to be that this template would crash if there were fewer than three articles. The version now on GitHub shouldn't do that.