Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
JesperDramsch opened this issue Jan 31, 2022 · 2 comments

Comments

@JesperDramsch
Copy link
Contributor

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.

@ralsina
Copy link
Member

ralsina commented Jan 31, 2022

Yeah, basically if it's set to anything it will be "True" ...

That change you made makes sense. Since there are not all that many users of these plugins I think it would be an acceptable thing.

@JesperDramsch
Copy link
Contributor Author

I could negate the command as

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

which would minimize surprising behaviour to anyone using it.
I'll make a quick PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants