question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dashboard product list is unusable if an image is missing

See original GitHub issue

Issue Summary

Thanks for introducing the thumbnailing abstraction. It’s something we’ve always wanted to do! Unfortunately, I think I found a small regression.

On one of my Oscar staging sites, not all images that are in the database are actually on disk. This leads to display errors in the frontend. More importantly, the product list in the dashboard becomes totally unusable, because an exception is thrown.

image

The exception is thrown if thumb.height or thumb.width are accessed. And indeed, product_row_image.html (the dashboard template) accesses those, and the storefront gallery.html doesn’t. That’s why the storefront only has display errors, but the backend throws an exception.

I wanted to work around this by checking {% if thumb %}, but that check always succeeds. My workaround is to remove the height and width section from the template. That template is the only place where thumb.height and width are accessed.

IIRC, Oscar used to handle this more gracefully. AbstractProduct.get_missing_image and the MissingProductImage class were introduced back in the days to pass a special hardcoded image through the thumbnailer. I think they’re still present, but not used. That way, display errors were avoided.

There are a few ways to fix this. I’m happy to assist, but have not worked on the new thumbnail abstraction, so would like some guidance on what the right fix is. The missing image approach was nice when it worked, but getting the file into the media folder was tricky. So I’m not convinced it’s the right approach. What I do know is that accessing a missing image should never keep the site from working.

Steps to Reproduce

  1. Make note of the product PK of the first product with an image in the dashboard product list.
  2. Use the Django shell to get the primary key of the ProductImage for that product.
  3. In the database, change catalogue_productimage.original to a non-existent path.
  4. Access that product in the frontend, and then in the dashboard product list.

Technical details

  • Python version: 3.8.5
  • Django version: 2.2.21
  • Oscar version: 2.1.1 (image_tags.py and product_row_image.html are unchanged on master, so I presume the issue still exists)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
maiksprengercommented, Jul 22, 2021

@solarissmoke Thanks for the prompt reply!

OSCAR_THUMBNAIL_DEBUG is one of the first things I tried, because of the code in image_tags.py. But I’ve just verified again, setting THUMBNAIL_DEBUG and OSCAR_THUMBNAIL_DEBUG to False have no effect. And DEBUG=False only means I don’t get a stacktrace - the exception is still thrown. I also know that the staging site where this was originally discovered runs with DEBUG=False.

0reactions
solarissmokecommented, Aug 19, 2021

get_missing_image is still used, here, if a product has no images?

Agree with removing width/height attrs - PR welcome for that!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't remove panel containing missing visualization ... - GitHub
If a panel is really narrow and the visualization is deleted, then a) the context menu gets cropped off and unusable and b)...
Read more >
How to check which products are still missing images
But what if you want to just view the products that are missing images? Click on "Advanced Options" to the right of the...
Read more >
Troubleshoot Non-visible Items in Square Online
If your items display as Unavailable or don't appear at all on your Square Online site, there are a few things to consider...
Read more >
Most Common Facebook Product Feed Errors and How to Fix It
1. Missing image link: ... Pretty sure, your product is not having any image at the moment. To fix this, you will need...
Read more >
35 Common Merchant Center Errors + How to Fix Them
A complete guide of the 35 most common Merchant Center errors plus how to prevent and fix them. Price mismatch, missing shipping, incorrect...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found