Skip to content

fixed cookmate local recipe image import - #4820

Open
LakshmikanthanC wants to merge 1 commit into
TandoorRecipes:developfrom
LakshmikanthanC:recipe4817
Open

LakshmikanthanC wants to merge 1 commit into
TandoorRecipes:developfrom
LakshmikanthanC:recipe4817

Conversation

@LakshmikanthanC

Copy link
Copy Markdown

Implemented the proper fix so Cookmate .mcb local photos are imported during normal import (no separate API pass needed).
Changes
cookbook/integration/cookmate.py:68-98 — Rewrote the image import step:

  • Reads and loads the photo directly from the .mcb archive via self.safe_read(), falling back to a basename match if the stored path differs slightly.
  • Falls back to the remote fetch only when no local image was found.
  • Uses is not None checks instead of lxml truth-testing. This mattered: lxml 6.x reports elements containing only text (like images/a.jpg) as falsy, so a truthy-test would silently skip them. It also removes the AttributeError on self-closing empty elements.
  • Detects the filetype (get_filetype) so PNG/WebP photos keep their format.
    cookbook/integration/integration.py:191 — Sets self.import_zip = import_zip in the Cookmate branch of do_import (same pattern already used by the Gourmet integration), so get_recipe_from_file can reach the archive.
    cookbook/tests/other/test_cookmate_integration.py — New tests covering: local image from archive, remote imageurl fallback (mock safe_request), and empty/self-closing / elements (no crash, no image).

@CLAassistant

CLAassistant commented Sep 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@TanguyDOPLER

Copy link
Copy Markdown

Top! It should fix the problem
Thanks for your time !!

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

3 participants