Forum OpenACS Development: Re: ad_page_contract to be used on includes

Posted by Dave Bauer on


If I understand what you are saying, there are query variables that are not referred to in the parent call to ad_page_contract, so if the query vars are not parsed in the include, the query params are never set, so we need to parse the query for the include also.

The intention is that if you happen to refer to the same variable in the parent page and the include that ad_page_contract does not cause an error. This is the opposite of what you are doing, I think.

Right now if this happens ad_page_contract tries to create a variable that already exists and causes an error.

So maybe the key is to check is the variable already exists before trying to create another one?

Jun,  would this work for what you are trying to do?

I'd rather not create another proc unless there is no other solution that does not break existing code.

Posted by Robert Locke on
Hi Dave,

Sorry Dave, I should have read your bug report more carefully.  I think there are 2 separate issues here.

One has to do with your bug (ie, ad_page_contract throws an error when the variable already exists from a previous invocation of ad_page_contract).  Checking for its existence seems like a reasonable solution, though it might mask a deeper problem relating to parse levels and such.  I dunno.

The other has to do with allowing 'includes' to provide a contract for invoking them.  If this is a desired feature, I like Peter's idea for an ad_include_contract.

In any case, bottom line, I don't think ad_page_contract's fundamental behavior should be changed in any way (other than fixing that weird bug ofcourse!)