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?

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


CategoryMoinMoinNoBug

MoinMoin: MoinMoinBugs/1.9Missing_http_user_agent (last edited 2009-10-09 21:22:33 by RogerHaase)