Edgewall Software
Modify

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#8377 closed defect (worksforme)

SetEnv PYTHON_EGG_CACHE fails with TracEnvParentDir

Reported by: hollow@… Owned by:
Priority: normal Milestone:
Component: web frontend/mod_python Version: 0.11.2
Severity: normal Keywords: verify
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

If multiple trac environments are used together with TracEnvParentDir, the changes introduced in r7440 in modpython_frontend.py fail to pick up the SetEnv option for PYTHON_EGG_CACHE, since TracEnvParentDir is checked first to build a default path. If one wants to use the implicit cache path in TracEnvParentDir trac fails too, since the cache is not a trac environment.

Example config:

SetHandler mod_python
PythonHandler trac.web.modpython_frontend
PythonOption TracEnvParentDir /var/lib/trac
PythonOption TracUriRoot /trac
SetEnv PYTHON_EGG_CACHE /var/www/localhost/egg_cache/

The workaround is to use PythonOption PYTHON_EGG_CACHE, but then the ENV code is useless. So either way, the logic has to be cleaned up :)

Attachments (0)

Change History (5)

comment:1 by Christian Boos, 15 years ago

Keywords: verify added
Milestone: 0.12.1

Probably, yes.

comment:2 by osimons, 15 years ago

That's a limitation of embedded mod_python - the process has initialized itself with OS variables from Apache launch, but mod_python can/will never use SetEnv and PassEnv directives - they have no effect. So, for anything mod_python, PythonOption needs to be used.

There isn't anything the Trac project can do about that, and I think at least the TracModPython documentation uses PythonOption for all request-settings.

'worksforme'?

comment:3 by Christian Boos, 15 years ago

Hm, are you sure SetEnv doesn't use putenv?

comment:4 by Christian Boos, 15 years ago

Milestone: 0.12.1
Resolution: worksforme
Status: newclosed

Ok, it doesn't look like.

So worksforme: use PythonOption.

What about the SetEnv HTTPS 1 from TracModPython#HTTPSissues, is that also wrong?

comment:5 by osimons, 15 years ago

No, that's right - but it shows up in req.environ and we read it from there as a per-request option. Which if fine. I should probably be more specific, as what I meant was that any SetEnv will not affect mod_python itself, and the environment mod_python use to initialize itself and its package loading and so on - the os.environ mod_python uses must be set before Apache starts, and not part of httpd.conf.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The ticket will remain with no owner.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from (none) to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.