--> Friday, August 29, 2003, 1:26:31 PM, [EMAIL PROTECTED] wrote:
-->> Friday, August 29, 2003, 12:09:38 PM,
-->> [EMAIL PROTECTED] wrote:
>> [snips]
>> res.write(req.serverSidePath('/index.psp')+'<br>')
>> # it returns '\index.psp' instead of the expected absolute path
> I consider this a bug, and this is why it happens...
> >>> import os.path
> >>> os.path.join('C:/Web/','/')
> '/'
> This is my fix... (with tabs to match HTTPRequest.py)
I'm including this again as an attachment because
it was mangled by the list server or something.
why-is-this-list-so-quiet'ly yours,
-Kai # kaishaku fix
def serverSidePath(self, path=None):
""" Returns the absolute server-side path of the request. If the
optional path is passed in, then it is joined with the server side directory to form a
path relative to the object.
"""
if not hasattr(self, '_serverSidePath'):
app = self._transaction.application()
self._serverSidePath, self._serverSideContextPath,
self._contextName = app.serverSideInfoForRequest(self)
if path:
if path[0]=='/' or path[0]=='\\':
return
os.path.normpath(self._environ['DOCUMENT_ROOT']+path)
else:
return
os.path.normpath(os.path.join(os.path.dirname(self._serverSidePath), path))
else:
return self._serverSidePath