From: Chuck E. <ec...@mi...> - 2001-02-06 05:01:02
|
serverSidePath() already exists for 5 classes. I'm not enthused about adding a serverSideDir() each place there is a path. I think the dir thing is fairly rare so I'd rather just use os.path.dirname(obj.serverSidePath()) which is what serverSideDir() would do anyway. -Chuck At 12:05 AM 2/6/2001 -0500, Jay Love wrote: >I'm globing the files in the servlet's directory. > > >OK, do want to add an optional kw arg to serverSidePath that specifis >that you want the directory, ie serverSidePath(dir=1), or should we just >keep serverSideDir()? > >Jay > > > > > > > And you can always do an os.path.dirname(req.serverSidePath()) if you have > > to, but don't bother with that approach if you're just going to do an > > os.path.join(). > > > > What are you doing with the dirname? > > > > -Chuck > > > > > > > > At 11:39 PM 2/5/2001 -0500, Jay Love wrote: > > > > >Chuck, it looks to me like serverSidePath() is returning the FULL path, > > >including the filename. Is this your intended behavior? If so, how do > > >I get the serverSideDir? Can we add an optional keyword arg? > > > > > >Jay > > > > > > > > > > > >On 24 Jan 2001 13:56:59 -0500, Chuck Esterbrook wrote: > > > > WEP: serverSidePath() > > > > Date: 01/24/00 > > > > > > > > This WEP replaces the "serverSidePath() & serverSideDir()" WEP from > > > 1/20/01. > > > > > > > > > > > > DESCRIPTION > > > > > > > > Dynamic web sites must often deal with the file system on the > server side. > > > > Several WebKit classes provide a method to return the server-side > path of > > > > an object and build relative paths from it. > > > > > > > > def serverSidePath(self, path=None): > > > > ''' > > > > Returns the absolute server-side path containing the object. > > > > If the optional path is passed in, then it is joined with the > > > server side > > > > directory to form a path relative to the object. You can use this > to build > > > > relative paths. For example: > > > > > > > > filename = app.serverSidePath('configs/fields.csv') > > > > > > > > Since os.path.join() is used, if the path argument is absolute, > > > it will be > > > > returned as-is. > > > > ''' > > > > > > > > Classes that implement this method include: > > > > AppServer > > > > Application > > > > Servlet > > > > HTTPRequest > > > > PlugIn > > > > > > > > > > > > In WebKit 0.4.1, Servlet and HTTPRequest have a serverSideDir(), > but this > > > > method is used almost exclusively like so: > > > > > > > > os.path.join(req.serverSideDir(), 'somePath') > > > > > > > > Which is more succinctly done as: > > > > > > > > req.serverSidePath('somePath') > > > > > > > > serverSideDir() should be deprecated and then removed in a later > version. > > > > > > > > Also, the existing serverPath() method should be replaced with > > > > serverSidePath(). > > > > > > > > In addition, none of the code implementing WebKit should rely on the > > > > current directory being the location of WebKit/, but instead, use the > > > > serverSidePath() of the appropriate object instead. > > > > > > > > > > > > _______________________________________________ > > > > Webware-discuss mailing list > > > > Web...@li... > > > > http://lists.sourceforge.net/lists/listinfo/webware-discuss > > >_______________________________________________ >Webware-discuss mailing list >Web...@li... >http://lists.sourceforge.net/lists/listinfo/webware-discuss |