You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-dev@tcl.apache.org by "David N. Welton" <da...@dedasys.com> on 2001/11/30 15:58:12 UTC

Re: Fwd: Re: open bug list / bug filecontext

Simon Hefti <he...@netcetera.ch> writes:

> > Ensure -path option in web::filecontext, or
> >   make it the first argument (depends on parent class)

> > 1) if I'm understanding correctly, the -path argument must be passed
> >    to this command?  And one way of doing that might just be to say
> >    "ok, the first command has to be -path", or maybe by eliminating
> >    the -path command and just stating that the first argument to
> >    filecontext is the path?

> > 2) What exactly does the reference to the 'parent class' mean?  I've
> >    been reading the code, and understand the idea behind the 'factory'
> >    somewhat, but the 'parent class'?  Does the factory system create
> >    subclasses?

> web::filecontext should probably have a -path argument to be able to
> specify the location of the data files.

So is there anything wrong with making it a required option within
filecontext itself? 

        if {! [info exists [subst $${ctxmgrname}::_path]] } {
                error "web::filecontext requires a -path argument"
        }

It does cause a number of tests to fail, but that happens when you
change an API.

> Now, why not make it a required argument instead of an option ?
> Because we could add an other data container, e.g. a DB, which would
> use excatly the same API (init, cset, commit etc). Here a path
> argument would not make sense, of course. This is what I meant with
> "parent class": whatever session container we use, it will be
> created using "web::sessioncontextfactory", which defines the
> methods _parseargs, init, new, commit, id, and _load and which
> creates the required, but not yet implemented methods load, save,
> and invalidate (in java we would use an "interface"). The "derived
> classes" then actually implement these methods, as you can see in:
> web::filecontext (also in sessctx.ws3) and in cookie.ws3.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: Fwd: Re: open bug list / bug filecontext

Posted by "David N. Welton" <da...@dedasys.com>.
Simon Hefti <he...@netcetera.ch> writes:

> David,
> 
> > So is there anything wrong with making it a required option within
> > filecontext itself?
> 
> No. I like your proposal.

Ok, I added the following:

    if {[info exists ${ctxmgrname}::_path] == 0} {
	error "web::filecontext requires a -path argument.  Use '-path %d' if you would like to keep the default behavior."
    }

and closed the bug.  Note that there were something like 10 test
cases, and one of the examples that had to be changed.  This change
will probably break existing applications that make extensive use of
::filecontext.

-- 
David N. Welton
   Consulting: http://www.dedasys.com/
Free Software: http://people.debian.org/~davidw/
   Apache Tcl: http://tcl.apache.org/
     Personal: http://www.efn.org/~davidw/

Re: Fwd: Re: open bug list / bug filecontext

Posted by Simon Hefti <he...@netcetera.ch>.
David,

> So is there anything wrong with making it a required option within
> filecontext itself?

No. I like your proposal.

Simon.

------------------------------------------------------------------------
Simon Hefti                                     simon.hefti@netcetera.ch
Netcetera AG, 8040 Zuerich    phone +41 1 247 79 47  fax +41 1 247 70 75