Where O Where Did My Data Buffer Go?

Ben Ocean zope at thewebsons.com
Thu May 3 06:38:14 EDT 2001


First a BIG THANK YOU to everyone that helped, ESPECIALLY Chris and Sheila!
Now, one more question for y'all...
What I *really* need to do is publish all this data to a Web page, which I 
have, no problem. But then, I need to be able to make it so the visitor can 
click a link and send that data to the client or call up a printable page 
with the data. So, how can I re-call my script and pass the data back, or 
somehow keep the data from the first call? Here's my broken code (notice 
variable *dataOriginal*):
 >>>
#!/usr/bin/python

import cgi, os
import string

print "Content-type: text/html\n\n"
form = cgi.FieldStorage()
formOriginal = form # do this to re-use the data for mailing back to 
BladeChevy, etc.

save = []
for i in form.keys():
     v = form[i].value
     save.append(i + ": " + v + "\n")
data = string.join(save,"")
dataOriginal = data # do this to re-use the data for mailing back to 
BladeChevy, etc.
data = string.replace(data, "%%", "<br>")
array = string.split(data, "QueryWindowStatus")
dataOriginal = string.replace(dataOriginal, "\"", "\\\"")

print # all sorts of html code
start = "<center><font style=\"font: italic 800 22px futura\">If you would 
like us to help you purchase this car, <a 
href=\"http://www.bladechevy.com/cgi-bin/kbb.cgi?key=send&"
middle = "\">click here!</a><br>For a printable version, <a 
href=\"http://www.bladechevy.com/cgi-bin/kbb.cgi?key=print&"
finish = "\">click here!</a></center><br> <br>\n"
aline = string.join([start, dataOriginal, middle, dataOriginal, finish])
print aline
print #  the rest of the html code
<<<
TIA,
BenO

At 11:51 PM 5/2/2001 -0500, you wrote:
>I have been corresponding with Ben on this and I think everyone else
>would find a clarification of the problem useful.
>
>As I understand it, when the end user visits KBB via the framed page,
>KBB gets a "callback" URL as part of the request.  At some point in the
>future KBB's web server will call Ben's server via that URL and send
>some arbitrary data.  This does not appear to be directly related to the
>end user's experience.
>
>Ben is trying to catch the data being sent and do something with it
>(presently, email it to himself).
>
>BTW the concept of "data buffer" is irrelevant to web servers outside
>the Windoze world.  The server in question is running Linux/Apache,
>so of course the data being sent via POST is in the sys.stdin stream.
>
>Also note for the record that calling cgi.FieldStorage() will *consume*
>the sys.stdin stream, so that subsequent sys.stdin.read() calls get
>nothing (i.e. EOF).
>
>
>
>--
>http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list