wagtail-cache icon indicating copy to clipboard operation
wagtail-cache copied to clipboard

PicklingError for SampleStreamBlockMeta

Open vladox opened this issue 4 years ago • 2 comments

We are getting the following error, is it a known issue?

_pickle.PicklingError: Can't pickle <class 'wagtail.core.blocks.base.SampleStreamBlockMeta'>: attribute lookup SampleStreamBlockMeta on wagtail.core.blocks.base failed

vladox avatar Nov 26 '21 17:11 vladox

How do you avoid caching in the Wagtail API? The issue is with an APIView, but I couldn't find a way for the middleware to ignore the API Calls.

vladox avatar Nov 27 '21 12:11 vladox

Good question. For the pickling error, what version of Wagtail and Django are you using?

As far as not caching the API, you'll need to disable the middleware, and either:

  • warp the specific URL routes in the cache_page decorator.
  • Or decorate the specific page models you want cached.

See this section in the docs: https://docs.coderedcorp.com/wagtail-cache/getting_started/install.html#only-cache-specific-views

Let me know if either of those approaches helps.

Hint while debugging: the HTTP Response contains an X-Wagtail-Cache header which indicates: skip, miss, or hit. If it is not present in the response then the URL is not even being touched by wagtail-cache.

vsalvino avatar Nov 29 '21 18:11 vsalvino