Skip to content

Surprising behaviour of plugin Medium and Devto (pseudo-boolean post options) #404

@JesperDramsch

Description

@JesperDramsch

I was a bit confused with the medium and devto plugins
(not sure other plugins have this problem).

The documentation says:

At that point your posts with the "devto" metadata set to "yes" or "true" should be published.

But I have a hard time remembering all the keywords, so I set the standard keywords to

medium: False
devto: False

This will lead medium and devto to publish all articles, due to something that I'd say is unintuitive and should be changed to improve usability.

The code says:

to_post = [post for post in posts if post.title() not in devto_titles and post.meta('devto')]

if post.title() not in medium_titles and post.meta("medium")

since post.meta('devto') is text, it will always be true, regardless of the value it was set.
(Pseudo-)Boolean keywords like this should probably have an "off" switch.

Locally, I changed mine to:

to_post = [post for post in posts if post.title() not in devto_titles and (post.meta('devto').lower() in ["yes", "true"])]

I don't know if that's the best way to handle it. Happy to discuss solutions and make a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions