Scheirle / pelican_comment_system

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

Plugin breaks pelican (NoneType object has no attribute 'lower' ) #8

Closed trev-dev closed 4 years ago

trev-dev commented 5 years ago

Heyo

I've been trying to get this system to work for me. Every time I try to run pelican I get as far as generating the comment XML feeds and then the program breaks down and nothing else gets rendered.

At this point I am not using any of the comments in any templates. I'm simply trying to run pelican with the plugin, I keep getting NoneType object has no attribute 'lower'

Screenshot_2019-05-21_17-44-20

I've tried both versions 1.3.0 and 1.4.0 of pelican_comment_system. I'm using Pelican 4.0.1 with pelican_comment_system and pelican installed in a Pipenv.

Here's my settings:

#!/usr/bin/env python
# -*- coding: utf-8 -*- #
from __future__ import unicode_literals
import time

AUTHOR = 'Trevor'
SITENAME = 'trevDev'
SITEURL = 'http://localhost:8000'
HOT_RELOAD = False

PATH = 'src/content'
OUTPUT_PATH = 'build'

STATIC_PATHS = ['images']

THEME = 'src/themes/trevdev'
THEME_STATIC_PATHS = ['static']
BLOG_TITLE = 'The Devblog'
BLOG_DESCRIPTION = "A devblog filled with tips, tricks, ideas and "\
    "ramblings regarding all things web development, security and programming."
META_DESCRIPTION = "A full stack web developer "\
    "from Vancouver Island who builds fantastic websites and cloud"\
    " based applications."

JS_VENDORS = ['vue.js', 'axios.min.js']

TIMEZONE = 'America/Vancouver'

DEFAULT_LANG = 'en'

# Feed generation is usually not desired when developing
FEED_ALL_ATOM = None
CATEGORY_FEED_ATOM = None
TRANSLATION_FEED_ATOM = None
AUTHOR_FEED_ATOM = None
AUTHOR_FEED_RSS = None

# Blogroll
LINKS = (('Pelican', 'http://getpelican.com/'),
         ('Python.org', 'http://python.org/'),
         ('Jinja2', 'http://jinja.pocoo.org/'),
         ('You can modify those links in your config file', '#'),)

SOCIALS = {
    'twitter': '@realTrevDev'
}

DEFAULT_PAGINATION = 10

DELETE_OUTPUT_DIRECTORY = True

# Uncomment following line if you want document-relative URLs when developing

# RELATIVE_URLS = True

# URLS

PAGE_URL = '{slug}/'
PAGE_SAVE_AS = '{slug}/index.html'
AUTHOR_URL = 'author/{slug}/'
AUTHOR_SAVE_AS = 'author/{slug}/index.html'
CATEGORY_URL = '{slug}/'
CATEGORY_SAVE_AS = '{slug}/index.html'
TAG_URL = 'tag/{slug}/'
TAG_SAVE_AS = 'tag/{slug}/index.html'
ARTICLE_URL = '{category}/{slug}/'
ARTICLE_SAVE_AS = '{category}/{slug}/index.html'
# YEAR_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/index.html'
# MONTH_ARCHIVE_SAVE_AS = 'posts/{date:%Y}/{date:%b}/index.html'

# Plugins

PLUGIN_PATHS = ['pelican-plugins', 'plugins']
PLUGINS = ['md_inline_extension', 'pelican-yaml', 'readtime', 'tipue_search', 'pelican_comment_system']

MD_INLINE = {
    '~~': ('text-decoration: line-through;',)
}

PELICAN_COMMENT_SYSTEM = True
PELICAN_COMMENT_SYSTEM_IDENTICON_DATA = ('author',)

My file paths

src
├── content
│   ├── comments
│   │   └── this-is-just-a-test
│   │       └── 0.md
│   ├── images
│   │   ├── 2019
│   │   │   └── freya.jpeg
│   │   ├── dicebag.png
│   │   ├── dodds.png
│   │   ├── gs.png
│   │   ├── test.jpeg
│   │   └── trooper.jpg
│   ├── pages
│   │   ├── hello.md
│   │   └── home.md
│   └── posts
│       ├── Blog
│       │   ├── 01-test-post.md <--- slug: this-is-just-a-test
│       │   └── 02-why-pelican.md
│       └── Portfolio
│           ├── dbg.md
│           ├── dodds.md
│           └── gs.md

The only reference to the str.lower() method I can find is in the init file: https://github.com/Scheirle/pelican_comment_system/blob/0ac19ef03e81945d3ac6f58cd8ae2162f5feb9ca/pelican_comment_system/__init__.py#L182-L195

I tried wrapping the inside of the if block in a try/catch, if I do this, the script finishes, all of my site gets generated and 0 comments get generated, so the problem is definitely here. Perhaps it's in the reader_read_file() method.

trev-dev commented 5 years ago

I have managed to isolate my issue to Pelican 4.01. The problem does not occur in Pelican 3.71. I'm assuming some sort of breaking change occurred between 3.71 and 4.0 for the pelican_comment_system

trev-dev commented 5 years ago

Dug into your pull requests. Replicating this merge request fixes the plugin for me in pelican 4.0.1 - https://github.com/Scheirle/pelican_comment_system/pull/7

justinmayer commented 5 years ago

Thanks to @MinchinWeb, the fix for this issue has been merged upstream and has been automatically published as Pelican 4.1.1, courtesy of AutoPub. ✨