|
Gustavo Córdova Avila
gustavo.cordova at q-voz.com
Mon Nov 8 12:56:18 EST 2004
Robert Geller wrote:
>Whoops! Sorry about that, I use Outlook, the client of death. :D
>
>How does mod python realize that Q, in your case, is the request object
>though? That's what confuses me.
>
>All this you have said is new to me, and I've definitely learned a lot!
>
>I can't quite figure out what that example does though. ;-)
>
>
Ewww, client of death indeed ;-)
mod_python simply puts the apache request object into the first
argument to the handler function, it's name is of no matter,
so I can call it "Q" with absolute impunity; I could call it
"req" or "request", or "Mr_X", since mod_python doesn't care
about it's name, only that it's the handler's first argument.
This handler is very simple:
1. Get list of attributes in request object ("dir(Q)").
2. Iterate through that list with variable "k".
3. For each attribute name:
3a. Get attribute's value ("v = getattr(Q,k)")
3b. Print it's name, type, and depending on it's
type, an external representation (or a blank).
And done. I did omit a "return apache.OK" at the end
though, you'll have to fill in the blanks.
hth!
--
Gustavo Córdova Avila <gustavo.cordova at q-voz.com>
<mailto:gustavo.cordova at q-voz.com>
*Tel:* +52 (81) 8130-1919 ext. 127
Integraciones del Norte, S.A. de C.V.
Padua #6047, Colonia Satélite Acueducto
Monterrey, Nuevo León, México.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20041108/43d6dcd5/signature.bin
|