Thanks for your reply, Gustaf. I see now that
::Generic::CrItem instantiate
doesn't actually load the object from the database, though the docs suggest it does: "returns object containing the attributes of the CrItem". So with a broken object, weirdness inevitably would follow.
I don't want to delay the active work you're doing on these packages -- and much appreciated work, too -- so maybe I should just delay my explorations until a later date.
Still, permit me a few more questions. I am having problems with your suggested test code. I have an xowiki instance with id 11385. Its root content_folder is id 11393, and the content_folder's ::xowiki::Object is id 11395 (and its name is ::11393). When I try what you suggest, here's what happens in the DS Shell:
set pkg_id 11385
set fldr_id 11393
set obj_id 11395
::xowiki::Package instantiate_page_from_id -item_id $obj_id
::Serializer deepSerialize ::$obj_id
returns this error:
ERROR:
Query did not return any rows.
while executing
"db_1row get_class "select content_type as object_type from cr_items where item_id=$item_id""
invoked from within
"ns_cache eval xotcl_object_type_cache [expr {$item_id ? $item_id : $revision_id}] {
if {$item_id} {
db_1row get_class "select content_type as ..."
(procedure "instantiate" line 4)
::Generic::CrItem->instantiate
invoked from within
"::Generic::CrItem instantiate -item_id $item_id -revision_id $revision_id"
(procedure "instantiate_page_from_id" line 4)
::xowiki::Package->instantiate_page_from_id
invoked from within
"::xowiki::Package instantiate_page_from_id -item_id $obj_id"
("uplevel" body line 9)
invoked from within
"uplevel 1 $script"
Thinking perhaps you meant to pass the folder -- not the folder object -- to ::xowiki::Package instantiate
:
set pkg_id 11385
set fldr_id 11393
set obj_id 11395
::xowiki::Package instantiate_page_from_id -item_id $fldr_id
::Serializer deepSerialize ::$fldr_id
reveals that presumably that's not what you meant:
ERROR:
invalid command name "content_folder"
while executing
"$object_type instantiate -item_id $item_id -revision_id $revision_id"
(procedure "instantiate" line 13)
::Generic::CrItem->instantiate
invoked from within
"::Generic::CrItem instantiate -item_id $item_id -revision_id $revision_id"
(procedure "instantiate_page_from_id" line 4)
::xowiki::Package->instantiate_page_from_id
invoked from within
"::xowiki::Package instantiate_page_from_id -item_id $fldr_id
"
("uplevel" body line 9)
invoked from within
"uplevel 1 $script"
I see that ::xowiki::Package instantiate_page_from_id
calls ::Generic::CrItem instantiate
, sets the package_id and folder_id, and does some other stuff -- but doesn't appear to get database data in the way that "select * from xowiki_objectx where object_id = $object_id"
would. Probably I'm still misunderstanding something basic here...
Anyway, thanks for any pointers. I'm trying to grok "The Xotcl Way" since I have several packages developed for OpenACS 3.x that am porting to 5.x and want to build with xotcl.