[Zope] Serving a sub-folder: 2nd Try
Evan Simpson
evan@tokenexchange.com
Mon, 28 Jun 1999 16:57:58 -0500
Having burned myself on the first try, here's a second approach which (knock
wood) appears to do everything right. It's simpler, too.
Forget editing App/manage_tabs.dtml, all we have to muck with is
ZPublisher/Publisher.py
Once again, find "URL=request.script" around line 360. Directly after it,
insert:
omit_steps=request.environ.get('ZOPE_OMIT_STEPS')
if omit_steps:
omit_steps = int(omit_steps)
request.other['PATH_INFO'] = '/'+join(path[omit_steps:], '/')
then, down around line 400, change "URL="%s/%s" % (URL,quote(entry_name))"
to:
if omit_steps:
omit_steps = omit_steps - 1
else:
URL="%s/%s" % (URL,quote(entry_name))
Now, in your rewrite rule, you can do something like:
RewriteRule ^/(.*) /subsite/$1 [E=ZOPE_OMIT_STEPS:1]
I've tested this with management screens, Confera cookies, and normal use,
and it seems solid. If you're bothered (as I was) by the lack of a root
link in the management screens' parent list, you can change line 110 of
App/Management.py from:
if not path: return ''
to:
elif path: path=['.']+path
else: return ''