Commit 8c0f966c authored by Vincent Pelletier's avatar Vincent Pelletier

ERP5Security._setUserNameForAccessLog: Add support for WSGI Z2 log.

parent 622b2b80
......@@ -63,13 +63,20 @@ def _setUserNameForAccessLog(username, REQUEST):
"""
# Set the authorization header in the medusa http request
# so that the username can be logged to the Z2.log
try:
# Put the full-arm latex glove on now...
try:
# Is this WSGI ?
REQUEST._orig_env['wsgi.input']
except KeyError:
# Not WSGI, maybe Medusa
try:
medusa_headers = REQUEST.RESPONSE.stdout._request._header_cache
except AttributeError:
pass
else:
medusa_headers['authorization'] = 'Basic %s' % encodestring('%s:' % username).rstrip()
else:
REQUEST._orig_env['REMOTE_USER'] = username
def initialize(context):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment