Bugs item #836157, was opened at 2003-11-05 00:53
Message generated for change (Comment added) made by cito
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=104866&aid=836157&group_id=4866

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: WebKit
Group: None
>Status: Closed
>Resolution: Fixed
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

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


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

>Comment By: Christoph Zwerschke (cito)
Date: 2006-07-07 23:42

Message:
Logged In: YES 
user_id=193957

An absolute path is now treated as if it was a relative one,
so you will always get a file system path back. This is
simply the concatentation of the current server side path
and the passed path and may be different from the server
side path if the passed path would be evaluated as a URL
(with adapter, context etc.). Fixed in SVN, will go into
Webware 0.9.2.

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

Comment By: Toyotomi Hideyoshi (kaishaku)
Date: 2004-02-16 19:51

Message:
Logged In: YES 
user_id=559878

I attached the code so it's easier to read, see the 
attachment instead of trying to decipher the code mutilated 
by sourceforge in the original message.

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

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

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Webware-devel mailing list
Webware-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to