Re: BaseHTTPServer weirdness

2006-09-12 Thread Steve Holden
Ron Garret wrote: In article [EMAIL PROTECTED], Kent Johnson [EMAIL PROTECTED] wrote: Steve Holden wrote: Ron Garret wrote: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't

Re: BaseHTTPServer weirdness

2006-09-12 Thread Ron Garret
In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: I wouldn't necessarily say you are wrong here, It's just that the cgi module has sort of just growed, so it isn't conveniently factyored for reusability in other contexts. Several people (including me) have taken a look

Re: BaseHTTPServer weirdness

2006-09-12 Thread Eddie Corns
Ron Garret [EMAIL PROTECTED] writes: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: I wouldn't necessarily say you are wrong here, It's just that the cgi module has sort of just growed, so it isn't conveniently factyored for reusability in other contexts. Several

BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
I'm trying to figure out how to use BaseHTTPServer. Here's my little test app: = #!/usr/bin/python from BaseHTTPServer import * import cgi class myHandler(BaseHTTPRequestHandler): def do_GET(r): s = '' try: s =

Re: BaseHTTPServer weirdness

2006-09-11 Thread Steve Holden
Ron Garret wrote: I'm trying to figure out how to use BaseHTTPServer. Here's my little test app: = #!/usr/bin/python from BaseHTTPServer import * import cgi class myHandler(BaseHTTPRequestHandler): def do_GET(r): s = '' try:

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: The normal way is s = cgi.parse() since the CGI script sees the client network socket (after consumption of HTTP headers) as its standard input. Doesn't work. (I even tried sys.stdin=r.rfile; s=cgi.parse()) Don't

Re: BaseHTTPServer weirdness

2006-09-11 Thread Steve Holden
Ron Garret wrote: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: The normal way is s = cgi.parse() since the CGI script sees the client network socket (after consumption of HTTP headers) as its standard input. Doesn't work. (I even tried sys.stdin=r.rfile;

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't working. Clearly. So what should I be doing? Surely I'm not the first person to have this problem? I have managed to work around

Re: BaseHTTPServer weirdness

2006-09-11 Thread Damjan
But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't working. Clearly. So what should I be doing? Probably you'll need to read the source of cgi.parse_qs (like Steve did) and see what it needs from os.environ and then provide that (either in os.environ or

Re: BaseHTTPServer weirdness

2006-09-11 Thread Steve Holden
Ron Garret wrote: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't working. Clearly. So what should I be doing? Surely I'm not the first person to have this problem? I

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: Ron Garret wrote: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't working. Clearly. So what

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article [EMAIL PROTECTED], Kent Johnson [EMAIL PROTECTED] wrote: Steve Holden wrote: Ron Garret wrote: In article [EMAIL PROTECTED], Steve Holden [EMAIL PROTECTED] wrote: But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't working.

Re: BaseHTTPServer weirdness

2006-09-11 Thread Ron Garret
In article [EMAIL PROTECTED], Damjan [EMAIL PROTECTED] wrote: But basically, you aren't providing a CGI environment, and that's why cgi.parse() isn't working. Clearly. So what should I be doing? Probably you'll need to read the source of cgi.parse_qs (like Steve did) and see what