[Web-SIG] The rewritten WSGI pre-PEP

Robert Brewer fumanchu at amor.org
Thu Aug 19 10:56:44 CEST 2004


> The ``environ`` dictionary is required to contain CGI environment
> variables, as defined by the Common Gateway Interface specification
> [2]_.  In addition, it must contain the following WSGI-defined
> variables:

> Finally, the ``environ`` dictionary may also contain server-defined
> variables.  These variables should be named using only lower-case
> letters, numbers, dots, and underscores, and should be prefixed with
> a name that is unique to the defining server or gateway.  For
> example, ``mod_python`` might define variables with names like
> ``mod_python.some_variable``.

I'm all for simplicity, but also for ubiquity; I'd like to see a
standard "uploads" entry in the environ dict. I'd really hate to see
environ['mod_python.uploaded_files'] which is different from, say,
environ['iis_asp.files_which_have_been_uploaded'] when they don't need
to be specialized. Example:

environ['uploads'] = {supplied_filename: read_func, ...}


mod_python, for example, would populate it via:

for param in (util.FieldStorage(req, 1).list or []):
    if param.filename:
        environ['uploads'][param.filename] = param.file.read
    else:
        # handle non-file param
        ...

Perhaps there are other candidates for standardized (but not required)
entries?


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org


* Introduction at the end: Hello, all. I'm fairly new to Python (~ 1
year). I just replaced the existing core business webapp at my company
(which I wrote in VB4 !) with a more enterprise-level Python one. So
I've rolled my own framework (templating, ORM, and multi-webserver), at
least once. ;) Oh, and I also wrote a wiki-like app to run on the same
framework.


More information about the Web-SIG mailing list