[mod_python] Underscore protection doesn't protect

Steve Freitas sflist at ihonk.com
Mon Nov 5 23:23:43 EST 2001


Hi,

I'm happily playing with mod_python 2.76 on Redhat 7.2. First I'd like to
say thanks for the docs. They're very well written -- I only wish you'd
written a whole book instead. :-) I'm looking forward to writing a customer
application in it.

I'm using mod_python.publisher to allow URL-level access to functions inside
a module, and I want to test protection of a function by prefixing its name
with an underscore. So first I set up httpd.conf with these lines:

AddHandler python-program .py
PythonHandler mod_python.publisher

Then I entered this into the module, myscript.py:

from mod_python import apache

def _blah(req):

    req.content_type = "text/html"
    req.send_http_header()
    req.write("Uh oh, you shouldn't be seeing this...")

    return apache

So when I go to the URL "http://127.0.0.1/myscript.py/blah", I get varying
results each time I reload the page. Sometimes I just get the "Uh oh" line
of text, other times I get the line of text plus Apache's version & modules
info, plus an Apache internal error message. If I remove the underscore, it
behaves as it should, just giving me the line of text.

Did I misunderstand this whole underscore thing?

Also, I may have a correction for the docs. In section 3.4, in the feedback
form HTML, in order to get the demo to work I had to change the action
element to read:

<form action="form.py/email" method="POST">

Was this just a doc mistake, or does it indicate that something is different
about my setup?

Thanks for your help!

Steve Freitas




More information about the Mod_python mailing list