Forum OpenACS CMS: Need help (newbie)

Collapse
Posted by Kevin Lau on
Hello,

I am a new OpenACS programmer picking up an OpenACS site written by a left programmer. I am fixing bugs left by him. =(

My problem is having server error when I try to delete a user group using delete-2.tcl (located in .../package/acs-subsite/www/admin/groups/delete-2.tcl)
The error should be due to a proc group::delete setup in .../package/acs-subsite/tcl/group-procs.tcl

I have try some tricks to work the problem around but in vain. Please point me if I have any stupid mistake.

I have attached the error message and the code at the end of the message.

Any comment are welcomed. Thank you very much.

Kevin

The error message is as following:
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Here is a detailed dump of what took place at the time of the error, which may assist a programmer in tracking down the problem:

Database operation "0or1row" failed (exception NSDB, "Query was not a statement returning rows.")
while executing
"ns_db 0or1row $db "select $function_name ()""
invoked from within
"db_exec_plpgsql $db $full_statement_name $sql $statement_name"
invoked from within
"if {[regexp -nocase -- {^\s*select} $test_sql match]} {
ns_log Debug "PLPGSQL: bypassed anon function"
set selection [..."
("uplevel" body line 6)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
# plsql calls that are simple selects bypass the plpgsql
# mechanism for creating anonymous fun..."
(procedure "db_exec_plsql" line 57)
invoked from within
"db_exec_plsql delete_group "
BEGIN
-- the acs_group package takes care of segments referred
-- to by rel_constraints.rel_segmen..."
(procedure "group::delete" line 16)
invoked from within
"group::delete $group_id"
invoked from within
"set group_type [group::delete $group_id]"
("uplevel" body line 2)
invoked from within
"uplevel 1 $transaction_code "
(procedure "db_transaction" line 1)
invoked from within
"db_transaction {
set group_type [group::delete $group_id]
}"
invoked from within
"if { [string eq $operation "Yes, I really want to delete this group"] } {
db_transaction {
set group_type [group::delete $group_id]
}
if ..."
("uplevel" body line 24)
invoked from within
"uplevel {
# /packages/mbryzek-subsite/www/admin/groups/delete-2.tcl

ad_page_contract {

Deletes a group

@author mailto:mbryzek@arsdigita.com...";
(procedure "code::tcl::/web/oacs5/service0/packages/acs-subsite/www/admi..." line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare "
(procedure "template::adp_parse" line 30)
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 5)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$path""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$path"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path_info..."
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Code of group::delete is as following:
==========================================================
ad_proc group::delete { group_id } {
Deletes the group specified by group_id, including all
relational segments specified for the group and any relational
constraint that depends on this group in any way.
@author Michael Bryzek (mailto:mbryzek@arsdigita.com)
@creation-date 10/2000
@return object_type of the deleted group, if it
was actually deleted. Returns the empty string if the
object didn't exist to begin with

@param group_id The group to delete

} {
if { ![db_0or1row package_select {
select t.package_name, t.object_type
from acs_object_types t
where t.object_type = (select o.object_type
from acs_objects o
where o.object_id = :group_id)
}] } {
# No package means the object doesn't exist. We're done :)
return
}

# Maybe the relational constraint deletion should be moved to
# the acs_group package...

db_exec_plsql delete_group "
BEGIN
-- the acs_group package takes care of segments referred
-- to by rel_constraints.rel_segment. We delete the ones
-- references by rel_constraints.required_rel_segment here.

for row in (select cons.constraint_id
from rel_constraints cons, rel_segments segs
where segs.segment_id = cons.required_rel_segment
and segs.group_id = :group_id) loop

rel_segment.del(row.constraint_id);

end loop;

-- delete the actual group
${package_name}.del(:group_id);
END;
"

return $object_type
}
=======================================================