Forum OpenACS Improvement Proposals (TIPs): Re: Tip #18 (Proposed): search order for master tag

Collapse
Posted by Tom Jackson on

I've spent even more time today trying to rid the master tag of the src bug. Again, this is a problem if you pass in a variable, either simple @a@ or array type: @a.b@, where the value of this variable is the empty string.

Well it turns out to be a very stick issue. It isn't at all easy to tell if the value is null.

In reference to the patch by Vinod. This is important for consideration of the method of choosing the master. The master tag is _not evaluated_ on every request! In fact it is evaluated once per thread, per unique url. That means you cannot calculate which master template to use inside the master tag, and then pass this hard coded value along.

I recommend a separate procedure for calculating the master template, and then pass the calculated value into the master tag by using one of the template variable types. Developers can then choose, dynamically, which template to use. This will also make it much easier to debug any template errors,or master template location errors which will show up.

An example of what could happen is that you could add a master template after the server starts up, and after the path to the master had been hard coded into the compiled master tag. The server will still use the old value until a restart.

Any procedure which is used to calculate the master template must always return a value. A null value will result in a very hard to track bug.