Bugs item #836157, was opened at 2003-11-04 17:53
Message generated for change (Comment added) made by kaishaku
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
# ----------------------------------------------------
-----------------
----------------------------------------------------------------------
>Comment By: Toyotomi Hideyoshi (kaishaku)
Date: 2004-02-16 12: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
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel