--> 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)

# ---------------------------------------------------------------------

        # 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

# ---------------------------------------------------------------------

-Kai



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to