[Zope-dev] [Patch] Optimization for development mode

Patrick Phalen zope@teleo.net
Thu, 30 Mar 2000 23:10:52 -0800


[Brian Lloyd, on Thu, 30 Mar 2000]
:: FYI guys - it looks like getmtime doesn't exist on windows 
:: (and possibly other platforms) - think we'll be able to 
:: get around that by sniffing the stat() structure though.


Funny, I thought os.path.getmtime() is supposed to be more portable
than the equivalent os.stat()[ST_MTIME].

It is used elsewhere in Zope:

/lib/python/App/special_dtml.py:            t=os.path.getmtime(self.raw)

And the stat alternative appears in some contributed Products:

/lib/python/Products/LocalFS/LocalFS.py:        t = DateTime(os.stat(path)[stat.ST_MTIME]) 
/lib/python/Products/ZMirror/ZMirror.py:          mtime = os.stat(fpath)[ST_MTIME] 


On Wed, Mar 29, 2000 at 07:55:51PM -0700, Shane Hathaway wrote:
> Ever since I started using Zope I thought its management
> interface was a little sluggish.  Today I found out why, and
> the correction is very easy.  If you are running Zope in
> development mode, especially in Unix, you will notice a
> healthy improvement in responsiveness.
> 
> It turns out that because of a small bug, every time a DTML
> file is read from the file system (including management
> pages) it is re-parsed whether the file was modified or not.
> The reason is because the current logic checks not only the
> file modification date but also the file access date, which
> changes every time the file is read.
> 
> Open lib/python/App/special_dtml.py in a text editor.
> Change one line (probably line 115) from:
> 
>          t=os.stat(self.raw)
> 
> to:
> 
>          t=os.path.getmtime(self.raw)