Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.280 -r1.281 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 27 Oct 2014 16:42:05 -0000 1.280 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 27 Apr 2015 15:28:22 -0000 1.281 @@ -782,7 +782,7 @@ csv-dump 1 download 1 list 1 } Package instproc invoke {-method {-error_template error-template} {-batch_mode 0}} { - if {![regexp {^[a-zA-Z0-9_-]+$} $method]} {return [my error_msg "No valid method provided!"] } + if {![regexp {^[.a-zA-Z0-9_-]+$} $method]} {return [my error_msg "No valid method provided!"] } if {[catch {set page_or_package [my resolve_page [my set object] method]} errorMsg]} { return [my error_msg -template_file $error_template $errorMsg] } @@ -792,18 +792,26 @@ if {[$page_or_package istype ::xowiki::FormPage] && [$page_or_package is_link_page] && [[self class] exists delegate_link_to_target($method)]} { - # if the target is a link, we may want to call the method on the target + # If the target is a symbolic link, we may want to call the + # method on the target set target [$page_or_package get_target_from_link_page] #my msg "delegate $method from $page_or_package [$page_or_package name] to $target [$target name]" if {$target ne ""} {set page_or_package $target} } if {[$page_or_package procsearch $method] eq ""} { return [my error_msg "Method '$method' is not defined for this object"] } else { - #my msg "--invoke [my set object] id=$page_or_package method=$method ([my id] batch_mode $batch_mode)" + #my msg "--invoke [my set object] id=$page_or_package method=$method ([my id] batch_mode $batch_mode)" + if {$batch_mode} {[my id] set __batch_mode 1} - set r [my call $page_or_package $method ""] - if {$batch_mode} {[my id] unset __batch_mode} + set err [catch { set r [my call $page_or_package $method ""]} errorMsg] + if {$batch_mode} {[my id] unset -nocomplain __batch_mode} + if {$err} { + ns_log notice "error during invocation of method $method errorMsg: $errorMsg, $::errorInfo" + return [my error_msg -status_code 500 \ + -template_file $error_template \ + "error during [ns_quotehtml $method]:
[ns_quotehtml $errorMsg]"] + } return $r } } else { @@ -1860,7 +1868,7 @@ # set temp_obj [::xowiki::Page new -name dummy -volatile] set slot [$temp_obj find_slot page_order] - db_transaction { + ::xo::dc transaction { foreach {page_id item_id name old_page_order new_page_order} [concat $drop_renames $gap_renames] { #my log "--cpo UPDATE $page_id new_page_order $new_page_order" $temp_obj item_id $item_id @@ -2121,7 +2129,7 @@ if {$parent_id == 0} {set parent_id [my folder_id]} if {![info exists user_id]} {set user_id [::xo::cc user_id]} if {![info exists objects]} {set objects [::xowiki::Page allinstances]} - set msg "processing objects: $objects
" + set msg "#xowiki.processing_objects#: $objects
" set importer [Importer new -package_id [my id] -parent_id $parent_id -user_id $user_id] $importer import_all -replace $replace -objects $objects -create_user_ids $create_user_ids append msg [$importer report] @@ -2325,7 +2333,7 @@ # Repeated parameter lookups are quite likely # - Class ParameterCache + Class create ParameterCache ParameterCache instproc get_parameter {{-check_query_parameter true} {-type ""} attribute {default ""}} { set key [list [my id] [self proc] $attribute] if {[info commands "::xo::cc"] ne ""} { @@ -2357,7 +2365,7 @@ Policy policy1 -contains { - Class Package -array set require_permission { + Class create Package -array set require_permission { reindex swa change-page-order {{id admin}} import-prototype-page swa @@ -2376,7 +2384,7 @@ } } - Class Page -array set require_permission { + Class create Page -array set require_permission { view none revisions {{package_id write}} diff {{package_id write}} @@ -2395,18 +2403,18 @@ create-or-use {{parent_id create}} } -set default_permission {{package_id write}} - Class Object -array set require_permission { + Class create Object -array set require_permission { edit swa } - Class File -array set require_permission { + Class create File -array set require_permission { download none } - Class Form -array set require_permission { + Class create Form -array set require_permission { list {{package_id read}} edit admin view admin } - Class CrFolder -array set require_permission { + Class create CrFolder -array set require_permission { view none delete {{package_id admin}} edit-new {{item_id write}} @@ -2418,7 +2426,7 @@ # we require side wide admin rights for deletions and code # - Class Package -array set require_permission { + Class create Package -array set require_permission { reindex {{id admin}} rss none refresh-login none @@ -2436,7 +2444,7 @@ } } - Class Page -array set require_permission { + Class create Page -array set require_permission { view {{package_id read}} revisions {{package_id write}} diff {{package_id write}} @@ -2454,13 +2462,13 @@ create-or-use {{parent_id create}} } - Class Object -array set require_permission { + Class create Object -array set require_permission { edit swa } - Class File -array set require_permission { + Class create File -array set require_permission { download {{package_id read}} } - Class Form -array set require_permission { + Class create Form -array set require_permission { view admin edit admin list {{package_id read}} @@ -2473,7 +2481,7 @@ # we perform checking on item_ids for pages. # - Class Package -array set require_permission { + Class create Package -array set require_permission { reindex {{id admin}} rss none refresh-login none @@ -2491,7 +2499,7 @@ } } - Class Page -array set require_permission { + Class create Page -array set require_permission { view {{item_id read}} revisions {{item_id write}} diff {{item_id write}} @@ -2506,18 +2514,18 @@ create-or-use {{parent_id create}} } - Class Object -array set require_permission { + Class create Object -array set require_permission { edit swa } - Class File -array set require_permission { + Class create File -array set require_permission { download {{package_id read}} } - Class Form -array set require_permission { + Class create Form -array set require_permission { view admin edit admin list {{item_id read}} } - # Class FormPage -array set require_permission { + # Class create FormPage -array set require_permission { # view { # {{is_true {_creation_user = @current_user@}} item_id read} # swa @@ -2538,7 +2546,7 @@ # Policy policy5 -contains { - Class Package -array set require_permission { + Class create Package -array set require_permission { reindex {{id admin}} rss none refresh-login none @@ -2556,7 +2564,7 @@ } } - Class Page -array set require_permission { + Class create Page -array set require_permission { view {{item_id read}} revisions {{item_id write}} diff {{item_id write}} @@ -2572,20 +2580,20 @@ show-object swa } - Class Object -array set require_permission { + Class create Object -array set require_permission { edit swa } - Class File -array set require_permission { + Class create File -array set require_permission { download {{package_id read}} } - Class FormPage -array set require_permission { + Class create FormPage -array set require_permission { view creator edit { {{in_state initial|suspended|working} creator} admin } list admin } - Class Form -array set require_permission { + Class create Form -array set require_permission { view admin edit admin list admin