Thank you Ryan and Jun!  That workaround in my trac.wsgi has fixed the 
problem.  To close off the loop for others following, this is the change I 
made to my trac.wsgi:

Original application(..) method:
def application(environ, start_request):
    if not 'trac.env_parent_dir' in environ:
        environ.setdefault('trac.env_path', 
'/home/rhills/applications/trac/venv/trac_project')
    if 'PYTHON_EGG_CACHE' in environ:
        os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
    elif 'trac.env_path' in environ:
        os.environ['PYTHON_EGG_CACHE'] = \
            os.path.join(environ['trac.env_path'], '.egg-cache')
    elif 'trac.env_parent_dir' in environ:
        os.environ['PYTHON_EGG_CACHE'] = \
            os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
    from trac.web.main import dispatch_request
    return dispatch_request(environ, start_request)

New (working) application(..) method:
def application(environ, start_request):

    # By Rob Hills: Workaround for Passenger bug 
(https://github.com/phusion/passenger/issues/1828) that means spaces in 
URLs aren't properly decoded:
    # see also https://groups.google.com/g/trac-users/c/Jm9JbiG5BJg for 
detailed discussion
    import urllib
    environ['PATH_INFO'] = urllib.unquote(environ['PATH_INFO'])
    # End workaround.

    if not 'trac.env_parent_dir' in environ:
        environ.setdefault('trac.env_path', 
'/home/rhills/applications/trac/venv/trac_project')
    if 'PYTHON_EGG_CACHE' in environ:
        os.environ['PYTHON_EGG_CACHE'] = environ['PYTHON_EGG_CACHE']
    elif 'trac.env_path' in environ:
        os.environ['PYTHON_EGG_CACHE'] = \
            os.path.join(environ['trac.env_path'], '.egg-cache')
    elif 'trac.env_parent_dir' in environ:
        os.environ['PYTHON_EGG_CACHE'] = \
            os.path.join(environ['trac.env_parent_dir'], '.egg-cache')
    from trac.web.main import dispatch_request
    return dispatch_request(environ, start_request)


Many thanks again for all your help,

Rob Hills
Waikiki, Western Australia
On Tuesday, 29 December 2020 at 15:58:23 UTC+8 Jun Omae wrote:

> On Tue, Dec 29, 2020 at 4:22 PM RjOllos <rjo...@gmail.com> wrote:
> >
> > On Monday, December 28, 2020 at 11:17:41 PM UTC-8 Jun Omae wrote:
> >>
> >> On Tue, Dec 29, 2020 at 3:39 PM Ryan Ollos <rjo...@gmail.com> wrote:
> >> >
> >> > On Mon, Dec 28, 2020 at 9:50 PM Rob Hills <rcp....@gmail.com> wrote:
> >> >>
> >> >> Hi again Ryan,
> >> >>
> >> >> I am using mod_wsgi but because I am locked in to cPanel here, I 
> have to use the one that cPanel permits in its framework. I gather cPanel 
> uses the [
> https://www.phusionpassenger.com/docs/tutorials/what_is_passenger/ 
> Phusion Passenger] App server. It was quite a process getting Trac to even 
> work with this, I had to Google widely and knit together multiple tidbits 
> of information! Unfortunately this means that lots of the nuts and bolts 
> (like the Apache configuration) are hidden from the user.
> >> >>
> >> >> So, it's entirely possible I've mucked something up along the way to 
> cause this issue.
> >> >>
> >> >> My Trac instance web root has the following structure (the symlinks 
> were necessitated by Passenger!):
> >> >>
> >> >> cgi-bin folder
> >> >> htdocs folder
> >> >> public folder (symlink to htdocs)
> >> >> passenger_wsgi.py (symlink to cgi-bin/trac.wsgi)
> >> > ...
> >> > But maybe Passenger would capture it in a log? Or you could open a 
> file and output to a file?
> >> >
> >> > Ryan
> >>
> >> The issue has been reported at
> >> https://github.com/phusion/passenger/issues/1828, however it is not
> >> fixed yet.
> >>
> >
> > Good find!
> >
> > Would it be a sufficient workaround to modify the environ dict?
> >
> > import urllib
> > environ['PATH_INFO'] = urllib.unquote(environ['PATH_INFO'])
>
> Yeah. I think that's enough to work around for the issue.
>
>
> -- 
> Jun Omae <jun...@gmail.com> (大前 潤)
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to trac-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/ae0ad914-989a-4810-9f31-2ad5da78781fn%40googlegroups.com.

Reply via email to