Fixed bug with caching that was causing a test to fail.
Running Article.clear_cache() on deleting isn't enough to properly clear the cache. This is because get_cache_key() can return different values - so if you 1) create an article 2) then modify it 3) then delete, the cache of content after 1) is not cleared by Article.clear_cache() after 3). Therefore, when saving, we also clear the instance cache. This is more robust, and means we also don't have to explicitly delete Articles in test tearDown. This bug shows up particularly in tests, due to the increased possibility of IDs being re-used.
Showing
Please
register
or
sign in
to comment