[mod_python] GET works, but POST doesn't in mod_python

Ole Jacob Hagen waterthrill at yahoo.no
Mon Aug 9 11:03:08 EDT 2004


Hi.

I am experiencing the same problem as found in : 
http://mail.python.org/pipermail/python-list/2003-December/200961.html
I have successfully accomplished how to send forms from a top frame to a 
bottom frame.

So thanks for helping me out here.

Remember that I am using psp, instead of the publisher.

Output listings:

I will give output from bot_frame.psp, using both POST and GET in 
top_frame.psp:

user=mod_python
database=psp

When  method = \"GET\" in s
bot_frame will produce following output:
 
req.method is a GET[Field('user', 'mod_python'), Field('database', 'psp')]
length of incoming message is: 0

Which is correct, but when method=\"POST\" in s, bot_frame will produce 
following output:
req.method is a POST[]
length of incoming message is: 28

Why doesn't POST works? It seems that the POST message is stored, since 
the length of string is 28....
How can I retrieve it?

I'd like to use GET instead of POST, since GET has a size limit.


Cheers,

Ole J.









Listing of files:


frame_setup.psp:

def frame_setup():
   s = """<frameset rows=\"50%,50%\">
   <frame src=\"top_frame.psp\" name=\"top_frame\">
   <frame src=\"bot_frame.psp\" name=\"bot_frame\">
   </frameset>"""
   req.write(s)



%------------- top_frame.psp -----------%
<%
import DB_SB
def top_frame():
    form_to_bot()

def form_to_bot():
    s = """<form name=\"input\" method=\"post\" action=\"bot_frame.psp\" 
target=\"bot_frame\">
    Username:
    <input type=\"text\" name=\"user\"><br>
    Database:
    <input type=\"text\" name=\"database\">
    <input type=\"submit\" value=\"Submit\">
    </form>"""
    req.write(s)

%>
<html>

<%  top_frame()

%>

</html>

% ------------- end of top_frame.psp -------------------------%


% ----------- bot_frame.psp -----------------------%

<%

def bot_frame(name='default'):
    import types,util
    s = req.read()
    fs = util.FieldStorage(req)
    fslist = fs.list
    req.write("req.method is a %s" % req.method)   
    req.write("%s %s" % (fslist,"<br>"))
    req.write("length of incoming message is: %s<br>" % len(s))


%>
<html>

<%  bot_frame()

%>

</html>

% ---------- end of bot_frame.psp -------------------%




More information about the Mod_python mailing list