tylerbutler / engineer

A static website generator written in Python.
http://engineer.readthedocs.org/
MIT License
25 stars 3 forks source link

Better error message when no posts exist #96

Closed tylerbutler closed 4 years ago

tylerbutler commented 10 years ago

Current error:

Traceback (most recent call last):
  File "C:\Users\Tyler\.virtualenvs\engineer\Scripts\engineer-script.py", line 9, in <module>
    load_entry_point('engineer==0.5.0', 'console_scripts', 'engineer')()
  File "C:\Users\Tyler\.virtualenvs\engineer\lib\site-packages\engineer\engine.py", line 633, in cmdline
    args.func(args)
  File "C:\Users\Tyler\.virtualenvs\engineer\lib\site-packages\engineer\engine.py", line 318, in build
    'core/sitemap.xml']).render(post_list=all_posts)
  File "C:\Users\Tyler\.virtualenvs\engineer\lib\site-packages\jinja2\environment.py", line 969, in render
    return self.environment.handle_exception(exc_info, True)
  File "C:\Users\Tyler\.virtualenvs\engineer\lib\site-packages\jinja2\environment.py", line 742, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "C:\Users\Tyler\.virtualenvs\engineer\lib\site-packages\engineer\templates\core\sitemap.xml", line 6, in top-level template code
    <lastmod>{{ post_list[0].timestamp|date('%Y-%m-%dT%H:%MZ') }}</lastmod>
  File "C:\Users\Tyler\.virtualenvs\engineer\lib\site-packages\jinja2\environment.py", line 397, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: engineer.models.PostCollection object has no element 0