Forum OpenACS Improvement Proposals (TIPs): Re: TIP #144 Package Parameter Validation

Posted by Dave Bauer on
How about keying the implementation off the package key?

Then you can have one implementation per package that can validate all the parameters for that package.

Is that better or is having arbitrary implementations better for flexibility? The example seems to suggest keying on package key would simplify things.

Posted by Ryan Gallimore on
Keying by package key instead of package id makes sense. The implementation body does not actually need to know the package key, it just needs to call the right package implementation.

So you could call:

callback -impl validate_${package_key} \
subsite::parameter_validate \
-parameter SubsiteSearchP]

which would return a validation list for inclusion into ad_form. I may have to catch the line above in case the package implementation doesn't exist yet.

The implementation for search would just include the validation code for search parameters (see the switch in attached patch).