Index: openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 18 Apr 2008 20:09:30 -0000 1.7 +++ openacs-4/packages/xotcl-core/tcl/06-package-procs.tcl 10 Sep 2008 10:21:39 -0000 1.8 @@ -31,6 +31,9 @@ } } + ::xo::Package proc initialize args { + + } PackageMgr ad_instproc initialize { -ad_doc {-parameter ""} @@ -42,10 +45,9 @@ {-init_url true} {-form_parameter} } { - Create a connection context if there is none available. - The connection context should be reclaimed after the request - so we create it as a volatile object in the toplevel scope, - it will be destroyed automatically with destroy_on_cleanup, + Create the connection context ::xo::cc and a package object + if these are none defined yet. The connection context ::xo::cc + and the package object will be destroyed on cleanup, when the global variables are reclaimed. As a side effect this method sets in the calling context @@ -104,10 +106,30 @@ #my log "--R $package_id exists? [my isobject ::$package_id] url='$url'" if {![my isobject ::$package_id]} { #my log "--R we have to create ::$package_id //url='$url'" + # + # To make initialization code more generic, + # + set package_key [apm_package_key_from_id $package_id] + set package_class "" + foreach p [::xo::PackageMgr info instances] { + if {[$p package_key] eq $package_key} { + set package_class $p + break + } + } + if {$package_class eq ""} { + # For some unknown reason, we did not find the key. + # Be conservative, behave like in older versions, + # but complain in ns_log + ns_log error "Could not find ::xo::Package with key $package_key" + set package_class [self] + } + my log "PKG: $package_class" + if {$url ne ""} { - my create ::$package_id -url $url + $package_class create ::$package_id -id $package_id -url $url } else { - my create ::$package_id + $package_class create ::$package_id -id $package_id } ::$package_id destroy_on_cleanup } else { @@ -142,6 +164,7 @@ package_url {force_refresh_login false} } + ::xo::Package instforward query_parameter {%my set context} %proc ::xo::Package instforward exists_query_parameter {%my set context} %proc ::xo::Package instforward form_parameter {%my set context} %proc @@ -160,7 +183,6 @@ ::xo::Package instproc init args { #my log "--R creating" my instvar id url - set id [namespace tail [self]] array set info [site_node::get_from_object_id -object_id $id] set package_url $info(url) if {[ns_conn isconnected]} { @@ -202,10 +224,13 @@ } ::xo::Package instproc reply_to_user {text} { + #my log "REPLY [::xo::cc exists __continuation]" if {[::xo::cc exists __continuation]} { + #my log "REPLY [::xo::cc set __continuation]" eval [::xo::cc set __continuation] } else { if {[string length $text] > 1} { + #my log "REPLY [my set delivery] 200 [my set mime_type]" [my set delivery] 200 [my set mime_type] $text } }