Forum OpenACS Q&A: parameter::get_from_package_key problem

In a new oacs-5-10.1 package I added a couple of instance parameters setting the default values, but after changing the values via site-map the API doesn't return the expected results.
Executing an sql query against the apm_parameter_values woks well. I temporary solved the problem adding the parameters to /etc/config.tcl and in this case the API works well. but this is far from ideal.

Any help would be much appreciated.

Claudio

Collapse
Posted by Gustaf Neumann on
The usage of "parameter::get_from_package_key" is problematic, if there are multiple instances of packages with this key. The function predates global parameters, and returns either the value from the config file, or the value of a global parameter, or the value of a package instance parameter, if the package is defined as a singleton package.

Is the package defined as a singleton package?
If you really want to use instance parameters, you should probably not use parameter::get_from_package_key.

Here you can see the semantics of the function clearly:
https://openacs.org/api-doc/proc-view?proc=parameter::get_from_package_key&source_p=1