Re: [htdig] small patch to allow_in_form feature


Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Tue, 2 Feb 1999 14:58:34 -0600 (CST)


According to Alexander Bergolth:
> On Tue, 2 Feb 1999, Gilles Detillieux wrote:
>
> > I've been trying out the new allow_in_form feature, and found it has
> > a small but annoying quirk to it. The attributes you include in this
> > list get appended to the query strings for the links to other pages,
> > at the bottom of the search results, even if they're not given as input
> > parameters. This is inconsistent with the way other input parameters
> > are propagated by Display::createURL().
> >
> > The patch below corrects this problem. Leo, was this feature one that
> > you added? I was wondering if there was a reason that I'm overlooking
> > for why you get the parameters from config rather than from input,
> > in createURL(). It seems unnecessary to put the parameters in the query
> > string if that's not where they came from to begin with, as the stuff in
> > the configuration file isn't likely to change from one query to the next.
>
> Mhm - of course you are right.
> I think I did that in an earlier stage of writing this code to avoid that
> variables are added that are not in the allow_in_form list.
>
> I changed config["allow_in_form"] to input->get(form_vars[i]) in
> Display::setVariables and in Display::createURL.

Wait, no, setVariables() should still use config[form_vars[i]], not
input->get(form_vars[i])! The idea is that the value of the variable can
be determined by the configuration file attribute, but can be overridden
by an input parameter. htsearch.cc takes care of the overrides, by
making sure that any input parameters listed in allow_in_form, which are
actually given in the query string (and therefore exist in the "input"
dictionary), are also put into the "config" dictionary, raplacing any
values that were obtained from the configuration file. createURL()
only looks at the input dictionary, because it should only propagate the
true input parameters that htsearch got from its original query string,
and not attributes that are specified in the configuration file alone.
setVariables(), on the other hand, should look at the config dictionary,
because you want the variables to be set whether the attribute came from
the configuration file or from the query string. Almost all of the other
input parameters are handled in this fashion, so my feeling is that the
parameters listed in allow_in_form really should be handled the same way.

Of course, the allow_in_form attribute itself should only be read from
the config dictionary, and not the input dictionary, because you don't
want users to be able to override it!

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930
------------------------------------
To unsubscribe from the htdig mailing list, send a message to
htdig@htdig.org containing the single word "unsubscribe" in
the SUBJECT of the message.



This archive was generated by hypermail 2.0b3 on Wed Feb 10 1999 - 17:09:05 PST