[mod_python] meets_conditions does not seem to work

Graham Dumpleton grahamd at dscpl.com.au
Sun Dec 3 20:40:40 EST 2006


sliderw wrote ..
> Also, I would suggest updating the 3.3 changelog to mention this, because
> 3.3 does not transparently fix meets_conditions. Rather, anyone who uses
> meets_conditions in 3.2.x, and upgrades to 3.3, must make some change in
> his/her own code to make meets_conditions work.

I have added reference to req.meets_conditions() against MODPYTHON-130,
but I should point out that there was never actually anything wrong with the
meets_conditions() function itself. The short coming was that there was no
means to access the related ap_set_last_modified(), ap_set_etag() and
ap_update_mtime() functions used to set up data which ap_meets_conditions()
uses. The documentation was also misleading which didn't help. In summary,
it probably never was possible to use ap_meets_conditions() properly
through mod_python before 3.3, so I don't think there will be issues with
people upgrading.

Graham

> ----- Original Message ----- 
> From: "Graham Dumpleton" <grahamd at dscpl.com.au>
> To: "sliderw hotmail" <sliderw at hotmail.com>
> Sent: Wednesday, November 22, 2006 16:40
> Subject: Re: [mod_python] meets_conditions does not seem to work
> 
> 
> > The set_last_modified suggestion is a good one. The meets_conditions
> > documentation may be changed to:
> > 
> > Calls the Apache ap_meets_conditions() function which returns a status
> > code. 
> > If status is apache.OK, generate the content of the response normally.
> > If 
> > not, simply return status. Note that mtime (and possibly ETag) should
> be
> > set 
> > prior to calling this function. The same goes for req.status if the status
> > differs from apache.OK.
> > 
> > Example:
> > 
> > ...
> > r.headers_out['Expires'] = 'Mon, 18 Apr 2005 17:30:00 GMT'
> > r.headers_out['ETag'] = '"1130794f-3774-4584-a4ea-0ab19e684268"'
> > r.update_mtime(1000000000)
> > r.set_last_modified()
> > 
> > status = r.meets_conditions()
> > if status != apache.OK:
> >   return status
> > 
> > ... do expensive generation of the response content ...
> 
> Done in subversion documentation.
> 
> This email is off list as don't need to bother everyone. Any further responses
> to the list.
> 
> Thanks.
> 
> Graham


More information about the Mod_python mailing list