Where O Where Did My Data Buffer Go?

Ben Ocean zope at thewebsons.com
Wed May 2 18:31:42 EDT 2001


0At 09:54 PM 5/2/2001 +0000, you wrote:
>"Ben Ocean" <zope at thewebsons.com> wrote in ...
> > Hi,
> > I'm trying (for several days now) to capture data in a data buffer and
> > parse it. Someone suggested I use the *parse* functions in the cgi module
> > (which include *parse_qs* and *parse_qsl*). Okay, great. Now, how do I get
> > the freakin data buffer in there? In other words...
> > parse_qsl(???)
> > and I need to fill in the ??? It's not as easy as just tossing in *form*
> > from this line:
> > form = cgi.FieldStorage()
> > So, what do I do?
> > TIA,
> > BenO
> >
>Ben:
>
>I should say the first thing you needed was a clue. I've responded to your
>inquiries on the newsgroup and by email, without ever having any reply

Really?? I thought I had gratefully responded to everyone that had helped 
me! Apologies.

>, or
>any indication that your insight into the problem had improved.
>Are you simply stabbing around blindly, with no knowledge of the
>architecture of the system you are trying to build a component for? What's
>going on here? Asking the same question using five different wordings does
>not enlighten the unenlightened :-)
>
>Where IS "the freaking data buffer"? We aren't mind readers (though some on
>c.l.py do well at psychic debugging). Is the page you are framing from some
>other site a form?

I *have* made that fact perfectly clear in other posts, Steve.

>If it is, then all it can send is CGI data, and the CGI
>module will meet your needs. What else do you need to know?

Um, maybe *how* to utilize the module? Try as I may, I haven't gotten it to 
spit out the data. That's why I asked above, what variable do I put into 
the parser to parse? And what kind of variable is it? A tuple? A dictionary?

>We can't help you solve your problem until we understand it. Until *you*
>understand it, that goal seems some distance off.

Well, of course, that *is always* the problem with people who are new to 
programming. If you can remember back in the distant past when you were new 
to this, unless you were blessed to have someone there to teach you, well, 
it's a bitch, huh? You can be a little understanding, right? If you care to 
point out where this newbie's screwing up, here's the source code, such as 
it is. Your help (or anyone's!) is appreciated.
TIA,
BenO

 >>>
#!/usr/bin/python
import os, sys, cgi, string, htmllib, xdrlib
print "Content-type: text/html\n\n"
form = cgi.FieldStorage()
Form = sys.stdin.read()
formstuff = ""

for i in range(len(Form)):
FormData = sys.stdin.readline()
safe = string.maketrans("`|~!@#$%^&*()_+=:;{}[]", "----------------------")
line = 
string.replace(string.replace(string.replace(string.translate(FormData, 
safe), "<input type-\"hidden\" name-\"", "."), "\" value-\"", "---"), 
"\">",".")
formstuff = string.join([formstuff,line])
FormData.close() # close the file
import smtplib
server = smtplib.SMTP("localhost")
server.sendmail("beno at thewebsons.com", "beno at thewebsons.com", formstuff)
server.quit()
<<<






More information about the Python-list mailing list