[mod_python] Re: [patch] vampire 1.1 remove unknown query variables

Johannes Erdfelt johannes at erdfelt.com
Tue Oct 19 19:50:02 EDT 2004

On Tue, Oct 19, 2004, Graham Dumpleton <grahamd at dscpl.com.au> wrote:
> On Oct 19 13:56, Johannes Erdfelt <johannes at erdfelt.com> wrote:
> >
> > Subject: [patch] vampire 1.1 remove unknown query variables
> >
> > +    # We definately had some missing variables, let's let the user know
> > +    req.content_type = "text/plain"
> > +    req.status = apache.HTTP_INTERNAL_SERVER_ERROR
> > +    req.send_http_header()
> > +    req.write("Call is missing these variables: %s\n" % ", ".join(missing))
> > +
> > +    return apache.OK
> I am a bit wary of directly generating an error response from this point in
> the code.
> What may be better is to raise a Python RuntimeWarning exception with the
> description of the problem. This will cause mod_python to still return an
> internal server error, but one where the details would only be visible when
> PythonDebug option is set to On. The error would also be logged into the
> log file automatically.

That's a good point. Some people may not want this level of information
to be returned to the user.

On the other hand, I hate Internal Server Error messages (and shame on
me for returning that as the error too :). They are kind of misleading
in this case because the error isn't internal to the server, but in the
request from the client.

To some extent, the error code that is returned is a problem since it
causes alarms with my log analysis scripts, but I'm more concerned with
the message that is returned.

> Anyway, still have to come to grips with the whole patch and what it does.
> Now that I am at work, will have a bit of time to consume what it does. I have
> a couple of other questions to throw into the mix as well. The form validation
> mechanism also looks interesting and I will need to digest that as well.

Ok, let me know if you have any questions.


More information about the Mod_python mailing list