|
14 | 14 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
15 | 15 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
16 | 16 | # |
17 | | -# $Id: ZRoundup.py,v 1.5 2002-05-14 23:36:25 richard Exp $ |
| 17 | +# $Id: ZRoundup.py,v 1.6 2002-06-12 00:59:44 dman13 Exp $ |
18 | 18 | # |
19 | 19 | ''' ZRoundup module - exposes the roundup web interface to Zope |
20 | 20 |
|
@@ -123,8 +123,23 @@ def _opendb(self): |
123 | 123 | instance = roundup.instance.open(self.instance_home) |
124 | 124 | request = RequestWrapper(self.REQUEST['RESPONSE']) |
125 | 125 | env = self.REQUEST.environ |
126 | | - env['SCRIPT_NAME'] = '/'.join(self.getPhysicalPath()[:-1]) |
127 | | - env['INSTANCE_NAME'] = self.id |
| 126 | + |
| 127 | + # figure out the path components to set |
| 128 | + import urlparse |
| 129 | + path = urlparse.urlparse( self.absolute_url() )[2] |
| 130 | + path_components = path.split( '/' ) |
| 131 | + |
| 132 | + # special case when roundup is '/' in this virtual host, |
| 133 | + if path == "/" : |
| 134 | + env['SCRIPT_NAME'] = "/" |
| 135 | + env['INSTANCE_NAME'] = '' |
| 136 | + else : |
| 137 | + # all but the last element is the path |
| 138 | + env['SCRIPT_NAME'] = '/'.join( path_components[:-1] ) |
| 139 | + # the last element is the name |
| 140 | + env['INSTANCE_NAME'] = path_components[-1] |
| 141 | + del path_components , path |
| 142 | + |
128 | 143 | if env['REQUEST_METHOD'] == 'GET': |
129 | 144 | # force roundup to re-parse the request because Zope fiddles |
130 | 145 | # with it and we lose all the :filter, :columns, etc goodness |
@@ -169,6 +184,10 @@ def __getitem__(self, item): |
169 | 184 |
|
170 | 185 | # |
171 | 186 | # $Log: not supported by cvs2svn $ |
| 187 | +# Revision 1.5 2002/05/14 23:36:25 richard |
| 188 | +# . fixed SCRIPT_NAME in ZRoundup for instances not at top level of Zope |
| 189 | +# (thanks dman) |
| 190 | +# |
172 | 191 | # Revision 1.4 2002/01/10 03:38:16 richard |
173 | 192 | # reformatting for 80 cols |
174 | 193 | # |
|
0 commit comments