[Zope-dev] image objects created on fly are not displayed & solution
Jonothan Farr
jfarr@real.com
Thu, 30 Mar 2000 15:13:45 -0800
1) The _p_mtime == None bug in Image.py is fixed in CVS.
2) I have fixed LocalFS to set _p_mtime correctly from the modification time of
the local file. This fix will be in the next release.
3) It is not possible to modify _p_mtime directly, but it is computed from
_p_serial which is writable. The code I use is basically:
import os, stat, time
from ZODB.TimeStamp import TimeStamp
def set_mtime(ob, path):
t = os.stat(path)[stat.ST_MTIME]
ts = apply(TimeStamp, time.gmtime(t)[:6])
ob._p_serial = repr(ts)
Hope this helps.
-jfarr
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Hi! I'm a signature virus.
Copy me into your .sig to join the fun!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
----- Original Message -----
From: Jephte CLAIN <minf7@educ.univ-reunion.fr>
To: <zope-dev@zope.org>; <minf7@educ.univ-reunion.fr>
Sent: Thursday, March 30, 2000 1:48 AM
Subject: [Zope-dev] image objects created on fly are not displayed & solution
> hello,
>
> any one who use LocalFS (on NT at least) might wonder why images served
> are not displayed.
> this is because image object created on fly apparently have
> self._p_mtime == None (because they are not stored in ZODB I suppose)
> all methods who use self._p_mtime test that case, except index_html from
> lib/python/OFS/Image.py, who use:
>
> last_mod = int(self._p_mtime)
>
> which raise an exception when self._p_mtime is None
>
> I include a patch which solve that problem, based on code from
> bobobase_modification_time
>
> ****************************
> by the way, is it possible to modify the _p_mtime attribute "by hand"?
> It would be cool for the LocalFS to serve objects with _p_mtime taken
> from the filesystem.
>
> jim?
>
> BTW, i am not on zope-dev list
>
> regards,
> jepthe clain
> minf7@educ.univ-reunion.fr