getpelican / pelican-themes

Themes for Pelican
https://getpelican.com/
2.12k stars 1.09k forks source link

Peli-Kiera: CRITICAL: 'pelican.contents.Article object' has no attribute 'next_article' #690

Closed fijam closed 3 years ago

fijam commented 3 years ago
#python --version
Python 3.7.3

# pelican --version
4.5.0

 # pelican-plugins
-> Plugins found:
  | pelican.plugins.neighbors

# pelican -s publishconf.py
CRITICAL: 'pelican.contents.Article object' has no attribute 'next_article'

pelican -D log:

 # pelican -s publishconf.py --ignore-cache -D
DEBUG: Pelican version: 4.5.0
DEBUG: Python version: 3.7.3
WARNING: %s usage in CATEGORY_FEED_ATOM is deprecated, use {slug} instead.
DEBUG: Finding namespace plugins
DEBUG: Namespace plugins found:
  | pelican.plugins.neighbors
DEBUG: Loading plugin `pelican.plugins.neighbors`
DEBUG: Registering plugin `pelican.plugins.neighbors`
[snip]
-> Writing /usr/share/nginx/www/blog/category/blog.html
-> Writing /usr/share/nginx/www/blog/category/blog2.html
-> Writing /usr/share/nginx/www/blog/author/overflow.html
-> Writing /usr/share/nginx/www/blog/author/overflow2.html
CRITICAL: 'pelican.contents.Article object' has no attribute 'next_article'
Traceback (most recent call last):
  File "/usr/local/bin/pelican", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/dist-packages/pelican/__init__.py", line 512, in main
    pelican.run()
  File "/usr/local/lib/python3.7/dist-packages/pelican/__init__.py", line 121, in run
    p.generate_output(writer)
  File "/usr/local/lib/python3.7/dist-packages/pelican/generators.py", line 686, in generate_output
    self.generate_pages(writer)
  File "/usr/local/lib/python3.7/dist-packages/pelican/generators.py", line 603, in generate_pages
    self.generate_drafts(write)
  File "/usr/local/lib/python3.7/dist-packages/pelican/generators.py", line 586, in generate_drafts
    blog=True, all_articles=self.articles, url=draft.url)
  File "/usr/local/lib/python3.7/dist-packages/pelican/writers.py", line 270, in write_file
    override_output)
  File "/usr/local/lib/python3.7/dist-packages/pelican/writers.py", line 202, in _write_file
    output = template.render(localcontext)
  File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.7/dist-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.7/dist-packages/pelican/themes/Peli-Kiera/templates/article.html", line 1, in top-level template code
    {% extends "base.html" %}
  File "/usr/local/lib/python3.7/dist-packages/pelican/themes/Peli-Kiera/templates/base.html", line 71, in top-level template code
    {% block content %}
  File "/usr/local/lib/python3.7/dist-packages/pelican/themes/Peli-Kiera/templates/article.html", line 58, in block "content"
    <a href="{{ SITEURL }}/{{ article.next_article.url }}">{{ " " }}</a>
  File "/usr/local/lib/python3.7/dist-packages/jinja2/environment.py", line 471, in getattr
    return getattr(obj, attribute)
jinja2.exceptions.UndefinedError: 'pelican.contents.Article object' has no attribute 'next_article'

I determined that the page which breaks Peli-Kiera is an article saved as draft.

aleylara commented 3 years ago

Thanks for pointing this out. I must admit I had never used the draft feature before. I will do a pull request but it might take a long time to get accepted. In the meantime you can use the fix already pushed to here

fijam commented 3 years ago

Thanks, I appreciate it!

justinmayer commented 3 years ago

@aleylara: I can ensure your PR is merged quickly, so please feel free to submit it. 😸

aleylara commented 3 years ago

Please see the PR as requested.

691 Minor bug fixes and UI changes

Cheers.

justinmayer commented 3 years ago

Presumably addressed via above PR. Thanks again, @aleylara.