Scheirle / pelican_comment_system

Allows you to add static comments to your articles on your Pelican blog.
Other
6 stars 1 forks source link

Error with new version of pelican: 'Pelican' object has no attribute 'get_writer' #9

Open trevorld opened 3 years ago

trevorld commented 3 years ago

I'm not sure if bug reports should go here or https://github.com/getpelican/pelican-plugins/issues . The "pelican_comment_system" seems to no longer work for me with the latest version of pelican. Instead I get a "'Pelican' object has no attribute 'get_writer'" error:

pelican -o output -s pelicanconf.py content --debug
DEBUG: Pelican version: 4.5.4
DEBUG: Python version: 3.8.5
DEBUG: Adding current directory to system path
DEBUG: Finding namespace plugins
DEBUG: Loading plugin `pelican_comment_system`
DEBUG: Registering plugin `pelican_comment_system`
DEBUG: Found generator: ArticlesGenerator (internal)
DEBUG: Found generator: PagesGenerator (internal)
DEBUG: Found generator: StaticGenerator (internal)
DEBUG: Template list: ['!simple/archives.html', '!simple/article.html', '!simple/author.html', '!simple/authors.html', '!simple/base.html', '!simple/categories.html', '!simple/category.html', '!simple/gosquared.html', '!simple/index.html', '!simple/page.html', '!simple/pagination.html', '!simple/period_archives.html', '!simple/tag.html', '!simple/tags.html', '!simple/translations.html', '!theme/analytics.html', '!theme/archives.html', '!theme/article.html', '!theme/article_infos.html', '!theme/author.html', '!theme/authors.html', '!theme/base.html', '!theme/category.html', '!theme/comments.html', '!theme/disqus_script.html', '!theme/github.html', '!theme/index.html', '!theme/page.html', '!theme/pcs/comments.html', '!theme/period_archives.html', '!theme/tag.html', '!theme/taglist.html', '!theme/tags.html', '!theme/translations.html', '!theme/twitter.html', 'analytics.html', 'archives.html', 'article.html', 'article_infos.html', 'author.html', 'authors.html', 'base.html', 'categories.html', 'category.html', 'comments.html', 'disqus_script.html', 'github.html', 'gosquared.html', 'index.html', 'page.html', 'pagination.html', 'pcs/comments.html', 'period_archives.html', 'tag.html', 'taglist.html', 'tags.html', 'translations.html', 'twitter.html']
CRITICAL: 'Pelican' object has no attribute 'get_writer'
Traceback (most recent call last):
  File "/home/trevor/.local/bin/pelican", line 8, in <module>
    sys.exit(main())
  File "/home/trevor/.local/lib/python3.8/site-packages/pelican/__init__.py", line 527, in main
    pelican.run()
  File "/home/trevor/.local/lib/python3.8/site-packages/pelican/__init__.py", line 93, in run
    generators = [
  File "/home/trevor/.local/lib/python3.8/site-packages/pelican/__init__.py", line 94, in <listcomp>
    cls(
  File "/home/trevor/.local/lib/python3.8/site-packages/pelican/generators.py", line 298, in __init__
    signals.article_generator_init.send(self)
  File "/usr/lib/python3/dist-packages/blinker/base.py", line 266, in send
    return [(receiver, receiver(sender, **kwargs))
  File "/usr/lib/python3/dist-packages/blinker/base.py", line 266, in <listcomp>
    return [(receiver, receiver(sender, **kwargs))
  File "/home/trevor/.local/lib/python3.8/site-packages/pelican_comment_system/__init__.py", line 89, in initialize
    _pelican_writer = _pelican_obj.get_writer()
AttributeError: 'Pelican' object has no attribute 'get_writer'
mpaglia0 commented 3 years ago

Same issue here!

LecygneNoir commented 3 years ago

Hello,

I had the same issue, tested a little around, and find that since some Pelican versions (commit), get_writer is simply renamed _get_writer :sweat_smile:

So you may patch line 89 of pelican_commentsystem to add a ``, and tadaaa

Hope it helps!

As unfortunately the project seems dead at the moment, I am unsure if a pull request is necessary, but Bernhard if you come around do not hesitate to ping me :kissing_heart:

While I am on it, thannnnnks a lot for this project, it's still very useful 4 years after the last commit!

mpaglia0 commented 3 years ago

Thank you indeed! Nevertheless since this plugin requires also another javascript, I am hacking Static Comments in order to have a simple form but keep the plugin very simple and fast.