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

Bug: empty 'category' in recipe data (value: None) causes exception #138

Open
jayaddison opened this issue Jan 14, 2023 · 2 comments
Open
Labels
bug Something isn't working

Comments

@jayaddison
Copy link
Contributor

Steps to Reproduce

  1. Using the web importer, retrieve a URL that contains schema.org metadata, but no recipeCategory information

Expected Behavior

The recipe should be added to the database without a category.

Current Behavior

An exception is raised when attempting to comma-separate the category value (which is a Python None value).

if 'category' in dic:
cats = [v.strip() for v in dic['category'].split(',') if v]

Possible Solution

Replace 'category' in dic condition with dic.get('category') is not None (and add relevant test coverage).

Environment

  • Operating System: Linux with Python 3.10
  • Version or commit id: 139ca0b
  • Installed as Flatpak or Python package?: N/A (discovered while running pytest tests in a Python virtualenv)
@cydanil
Copy link
Contributor

cydanil commented Jan 16, 2023

Thanks for reporting this, I'm happy with the solution you propose, and I'll look into implementing it.
Do you happen to have at hand such a recipe that doesn't contain recipeCategory?

@jayaddison
Copy link
Contributor Author

No problem - and oops, yep - I should have provided an example URL:

@FriedrichFroebel FriedrichFroebel added the bug Something isn't working label Dec 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants