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
get_cached_content fails with 'SafeString object has no attribute append' error #1072
Comments
Thanks for reporting @jenda1 - seems like an issue that could perhaps be addressed with a test case and a fix. |
me too:
|
If there is agreement, I'll remove the "per-article-user" caching schema. It simplify the code, speed up the wiki, and fix this issue. I'll revert to "per-article" caching. TLDR; the "per-article-user" caching schema was added in 8cc19e5 by me. The idea was to allow the creation of a plugin that renders the page differently for each user. But I have not created such plugin, I came up with an easier way to achieve what I needed. AFIK there is no plugin that uses the functionality. |
I agree. |
I use cached sessions with LocMemCache and found the problem to be reproducible. I also couldn't find a cause in the django-wiki code. My guess would be that the cache pollution is related to sessions. But anyway, 1e4b2fd solves the problem and calls for a bugfix release! |
I confirm #1072 solves the problem |
#1080 may fix the exception but it will produce wrong cache results because the user session isn't taken into account. |
in models/Article.py, near line 260
I think the first cache entry will be overwritten with the second one. |
ah. Found it. the user key is sluggified, and that removes the ':'. AnonymousUser has an empty lastname, so the resulting cache_content_key then, everything woks correctly. @jenda1 "It looks that the cache content is set outside the get_cached_content method sometimes, but I do not know where..." |
I wil update test_cache test in test_models. Then I will fix the issue and submit a pull request. |
My main page gives me 500 because of this. Any workaround for 0.7? |
This issue is back and is confirmed with test cases added recently. |
get_cached_content()
expects thecached_items
is a list. It is... often. But sometimes it is a SafeString and then the linedjango-wiki/src/wiki/models/article.py
Line 258 in e5d6b97
It looks that the cache content is set outside the
get_cached_content
method sometimes, but I do not know where...There is the exception:
The text was updated successfully, but these errors were encountered: