[Web-SIG] Random thoughts
Ian Bicking
ianb at colorstudy.com
Fri Oct 31 01:28:01 EST 2003
On Oct 30, 2003, at 9:46 PM, Bill Janssen wrote:
>> * I oppose Simon Willison's practice of using the same variable
>> in the "GET" and "POST" part of a request, but I will defend to
>> the
>> death his right to do so. (But not in Quixote, where a narrower
>> definition of what is Right, Good, and Truthfull prevails.)
>
> I don't get it. Any particular request only has one method, not two:
> "GET" and "POST". Are you talking about for some reason
> special-casing these two methods in the Request class? I think it
> makes more sense to do things generically:
>
> request.path (e.g., '/foo/bar')
> request.method (e.g., "GET")
> request.part (e.g., "#bletch", perhaps without the #)
No real way to access this.
> request.headers
> request.parameters (either the query parms, or the
> multipart/form-data values)
I think fields is better name -- common, and a bit shorter (since it's
the most used part of the request)
> request.response() => returns a Response object tied to this request
>
> response.error(code, message) Sends back an error
Message, like response.error(404, "Not Found"), or response.error(403,
"Administrator permission is required to access this resource")
> response.reply(htmltext) Sends back a message
or setBody perhaps -- reply implies that the text will be immediately
(irrevocably?) sent. Maybe that's good, or maybe a separate
commit/close is better.
> response.open(ContentType="text/html", code=200) => file object to
> write to
I'm not sure I understand the purpose of the keyword arguments.
> fp.write(...)
> fp.close() Sends back the response
> response.redirect(URL) Sends back redirect to the URL
--
Ian Bicking | ianb at colorstudy.com | http://blog.ianbicking.org
More information about the Web-SIG
mailing list