Description
The request object is missing http_user_agent in Moin 1.9.0beta4.
My wiki has a custom macro that needs to know if it is being executed in command line mode (/script/export/dump.py). Prior to 1.9, it tested for request.http_user_agent == 'CLI/Script'.
Per PEP 333 (Python Web Server Gateway Interface) "HTTP_ Variables":
Variables corresponding to the client-supplied HTTP request headers (i.e., variables whose names begin with "HTTP_"). The presence or absence of these variables should correspond with the presence or absence of the appropriate HTTP header in the request."
Steps to reproduce
Do a dir of the request object.
Example
N/A
Component selection
* general
Details
Workaround
Is there a better way to test for command line execution?
- Have a look at environ. It is expected that some request/http related stuff has to change, due to wsgi refactoring.
- Duh... I should have been looking at request.environ.items() not dir(request.environ).
Apache WSGI
request.environ.items()= [...bunch of stuff deleted... ('HTTP_USER_AGENT', 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3 (.NET CLR 3.5.30729)'), ...bunch of stuff deleted...)];
CLI/Script export/dump
request.environ.items()= [...bunch of stuff deleted... ('HTTP_USER_AGENT', 'CLI/Script'), ...bunch of stuff deleted...)];
Discussion
Plan
- Priority:
- Assigned to:
- Status: