You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently updated from 2.0.9 to 3.0.11 in my buildout and noticed some test failures. I was able to identify the problem: when running tests, the image scales cache does not work.
"""Provide a callable to return the modification time of content
items, so stored image scales can be invalidated.
"""
context=aq_base(self.context)
date=DateTime(context._p_mtime)
returndate.millis()
During tests, a content item may have the _p_mtime attribute set to None. So the code above is actually doing DateTime(None), which returns the current date/time. The result is every time a scale is requested it considers the cached value invalid, because the object is considered modified.
In the old version context.modified() was used instead of _p_mtime, and this method always returned a non-None value.
I wonder how to solve this problem. Maybe modified should return a default date in the past?
The text was updated successfully, but these errors were encountered:
I recently updated from 2.0.9 to 3.0.11 in my buildout and noticed some test failures. I was able to identify the problem: when running tests, the image scales cache does not work.
The reason is in the following lines:
plone.namedfile/plone/namedfile/scaling.py
Lines 387 to 393 in 7fc0e67
During tests, a content item may have the
_p_mtime
attribute set toNone
. So the code above is actually doingDateTime(None)
, which returns the current date/time. The result is every time a scale is requested it considers the cached value invalid, because the object is considered modified.In the old version
context.modified()
was used instead of_p_mtime
, and this method always returned a non-None value.I wonder how to solve this problem. Maybe
modified
should return a default date in the past?The text was updated successfully, but these errors were encountered: