Forum OpenACS Development: Error updating parameters with xotcl-core installed

I am adding paramters to a new package that is not using xotcl or xotcl-core etc.

I get this error when try to set parameters from the subsite parameter page.

invalid command name ""
while executing
"$parameter_obj clear_per_package_instance_value $package_id $value"
(procedure "::callback::subsite::parameter_changed::impl::xotcl-param-pr..." line 9)
invoked from within
"::callback::subsite::parameter_changed::impl::xotcl-param-procs -package_id 838 -parameter ProductionMode -value 0"
("uplevel" body line 1)
invoked from within
"::uplevel 1 $procname $args"
invoked from within
"callback subsite::parameter_changed -package_id $package_id -parameter $c__parameter_name -value [set $c__parameter_name]"
invoked from within
"if { [info exists $c__parameter_name]} {
callback subsite::parameter_changed -package_id $package_id -parameter $c__parameter_name -value [set $c__p..."
("uplevel" body line 2)
invoked from within
"uplevel 1 $code_block "
("1" arm line 1)
invoked from within

I tracked this down to this procedure:

#
# For the time being: catch changed parameter values
#
ad_proc -public -callback subsite::parameter_changed -impl xotcl-param-procs {
-package_id:required
-parameter:required
-value:required
} {
Implementation of subsite::parameter_changed for xotcl param procs

@param package_id the package_id of the package the parameter was changed for
@param parameter the parameter name
@param value the new value
} {
#
# In order to use the existing inerface for parameters, we catch
# all parameter changes and update accordingly the values in the new
# interface.
#
set parameter_obj [ ::xo::parameter get_parameter_object \
-package_key [apm_package_key_from_id $package_id] \
-parameter_name $parameter]
$parameter_obj clear_per_package_instance_value $package_id $value
if {[$parameter_obj default_value] ne $value} {
$parameter_obj set_per_package_instance_value $package_id $value
}
}

This runs for every parameter change, whether its an xotcl based package or not. I am not sure what's going on, but it should not fail, i assume.

Adding a check for empty string for parameter_obj should fix it.

(Using OpenACS 5.4 from CVS oacs-5-4 branch)

Collapse
Posted by Dave Bauer on
Ok I tracked this down.

The XO parameter stuff is getting confused if you add a new parameter to a package type in the APM, and try to set it in a package instance before restarting. After restarting it works fine.

Collapse
Posted by Tom Jackson on

This is probably still a bug, or a difficult to understand "feature" of the xotcl object initialization.

The variable $parameter_obj gets set to the initial value of "". It should probably remain unset until explicitly defined, or the error should somehow expose which parameter object was not found.

For instance, you could use:

if {[info proc $parameter_obj] ne "$parameter_obj"} {

   return -code error "Parameter object proc dne, maybe restart server."

} 

$parameter_obj ...

Collapse
Posted by Dave Bauer on
Well installing xotcl-core breaks a core feature that allows you to add parameters to a package.

This should not require a restart. The xotcl-core code is broken as is.

Collapse
Posted by Gustaf Neumann on
Come on folks, this was just simple bug in an infrequently used situation, introduced 15 months ago. There is no magic involved. The cross-influence came due to the value-changed callback. Dave is certainly right, there should be no need to restart nsd in such situations.

xotcl-core is fixed in head an in the oacs-5-4 branch. It would be even better to have a callback for situations, where a new apm-parameter is created or deleted (like a constructor/destructor). Sorry, it took me 2 days to look into the problem. Shouldn't we use the bug-tracker for such cases?

btw., while i was looking at this, i fixed yet another case of the 'adding missing FROM-clause entry for table ...' in acs-admin

-gustaf neumann