Forum OpenACS Development: Re: Re: Re: xotcl object cache behavior?
- In oder to determine the (root) folder_id from a package (e.g. in order to fetch xowiki pages from this folder)
set Package [::xowiki::Package create ::$package_id]
set folder_id [$Package folder_id]
- In order to determine the folder_id from a page:
set folder_id [$page parent_id]
It took me yesterday a couple of hours to find a bug where i had several code pieces with
::namespace:cmd (note the missing second colon), so i need some break or better glasses. i am currently finishing a ~1000 page book, and i am doing the xowiki stuff mostly as a recreational activity. On the 18th i am going on vacation, until then i try to finish up the pending things.
assume, you have a folder 16059, you might have a folder object with the id 16068 and the name ::16059 The next two commands do create the object and show it to you (you can run this from the shell). ::xowiki::Package instantiate_page_from_id -item_id 16068 ::Serializer deepSerialize ::16068
Is there somewhere in the api that returns the id "16068" in your example? In any case, I see how to work around this for now, and I realize that you're actively working on all this. I really appreciate all your ongoing contributions! You are amazingly productive!
By the way, is your book entitled "Using XOTCL with OpenACS"? That would be a most excellent title! 😊
set P [::xowiki::Package create ::$package_id]
set folder ::[$P folder_id]
set folder_id [$folder set folder_id]
set folder_item_id [$folder set item_id]
set folder_revision_id [$folder set revision_id]
btw, in the next release, you can do
instead of the Serializer::...
The new code is stabilizing, and has some cool features. For example, i added some code to instantiate values from an sql query into an object. normally you get the return variables into the current scope of a function. In order to implement this, only one line was needed
::xotcl::Object instforward db_1row -objscope
db_1row is a forwarder applicable to all objects that makes the instance variables of an object to appear as local variables (the flag
-objscope). So, if you do a
$obj db_1row query_name "select some_atts from ..."
the return variables are set as instance variables of the object. This is quite important for dynamic sql queries, where there is no control over the output variables, where it is quite easy to overwrite local variables. the standard set of db-commands allows already array output, but for oo style of code, the above variant is much more convenient and saves copying of values...