I have an apache2 server with active mod-wsgi, but I can't get the environment variable PYTHON_EGG_CACHE.
Here the important lines out of my virtualhost.conf:
DAV svn
SVNParentPath /var/svn
SVNListParentPath Off
WSGIProcessGroup sites
WSGIApplicationGroup %{GLOBAL}
SetEnv PYTHON_EGG_CACHE /var/trac/eggs
AuthType Basic
AuthName "Restricted SVN"
AuthBasicProvider wsgi
WSGIAuthUserScript /var/trac/cgi-bin/acctmgr_auth.wsgi
Require valid-user
And here the acctmgr_auth.wsgi:
import os, sys
os.environ['PYTHON_EGG_CACHE'] = PYTHON_EGG_CACHE
from trac.env import open_environment, Environment
acct_mgr = None
def check_password(environ, user, password):
global acct_mgr
# Try loading the env from the global cache, addit it if needed
environ['PYTHON_EGG_CACHE']
env = open_environment(environ['trac.env_path'], use_cache=True)
if acct_mgr is None:
from acct_mgr.api import AccountManager
acct_mgr = AccountManager
if acct_mgr(env).check_password(user, password):
return True
else:
return False
def groups_for_user(environ, user):
return ['']
The single environ['PYTHON_EGG_CACHE']
is just a test, but I get a
KeyError: 'PYTHON_EGG_CACHE'
.
I also tried following, but I get the same error as above:
RewriteCond ${lowercase:%{REQUEST_URI}} ^/svn/([^/]+)
RewriteRule . - [E=trac.svn_path:/var/trac/envs/%1]
What is wrong?
Thanks for any advices.
EDIT: After some resarch I think I found the problem. The mod_dav is configured for the location /svn and it processes the request immediately, so the rewritecond and rewriterule will be ignored.
Is there any possibility to set environment variables with mod_dav?