On Thursday 21 February 2002 02:21 am, Edmund Lian wrote:
> Hi,
>
> I'm trying to figure out how to reuse ConfigurableForServerSidePath
> to read a configuration file. In the doc string for this class, there
> are a couple of sentences I don't quite understand:
>
> 1. "This is a version of Configurable that provides a customized
> setting() method for classes which have a serverSidePath() method."

WebKit classes originally inherited from Configurable. Then 
ConfigurableForServerSidePath was snuck is so that when someone said:

        obj.setting('SomeFileName')

The SomeFileName value would be relative to obj.serverSideForPath() 
rather than os.getcwd() which, if you think about it, has no bearing 
(sp?) on specific WebKit objects.

Of course, if the value of SomeFileName is an absolute path like 
"/foo/bar", then the point is moot. But if it's "foo/bar", then the 
point comes into play.


> 2. "In other words, relative filenames and directory names are
> expanded with the location of the object, NOT the current directory."
>
>
> What I don't understand is:
>
> A. What is the significance of the value of serverSidePath(), because
> I see it is defined and redefined differently in different Webware
> classes. Does the value represent the absolute path to the directory
> that contains the class which invokes this method?

It is the absolute server side file system path associated with the 
object in question. For servlets, you'll get a full path name. For 
something like the app server, I think you get the directory (but I 
don't recall for sure).


> B. What does sentence 2 above mean? What object? The one that is
> instantiated, or the class that contains the object definition?

Relative to the location of the receiver of the message, setting() 
where location = receiver.serverSidePath(). e.g., the instantiated 
object.


> C. How is ConfigurableForServerSidePath supposed to be used? If I
> make my SitePage a subclass of (Page, ConfigurableForServerSidePath),
> and I try to retrieve settings, I get a self._serverSidePath
> attribute not defined error. So, the constructor for my SitePage
> obviously needs to set self. _serverSidePath to some value first, but
> what is the right value, and shouldn't this default value properly be
> in the constructor for either Configurable or
> ConfigurableForServerSidePath?

In my own SitePage, I just used MiscUtils.Configurable and defined the 
configFilename() to be the right thing. I probably made use of __file__ 
to do that.

Using ConfigurableForServerSidePath seems reasonable, however. I'm not 
sure why you get the exception. If you want, send me your traceback.


-Chuck

_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to