Bugs item #836157, was opened at 2003-11-04 17:53
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=836157&group_id=4866

Category: WebKit
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Toyotomi Hideyoshi (kaishaku)
Assigned to: Nobody/Anonymous (nobody)
Summary: HTTPRequest serverSidePath does not accept absolute sitepath

Initial Comment:
req.serverSidePath accepts relative site paths fine, but 
does not work with an absolute site path.

This : 
  req.serverSidePath('/index.psp')

Will return :
  '\index.psp'

Instead of the expected absolute path.

My solution, possibly incorrect for some installations but 
works for me, is as follows :

                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

The 2nd if and it's return statement are the addition.

The whole serverSidePath now looks like this. I have 
been using this for months. This functionality is fully 
common to web development platforms I depend on.

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

        # 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

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


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=836157&group_id=4866


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to