Forum OpenACS Q&A: Re: Some tips about XoTcl development best practices

Collapse
Posted by Gustaf Neumann on
what do you mean by "view documentation"? on your local installation? on OpenACS.org? One can certainly view ::xo::db::select_driver in the api-browser [1]. can it be that you made a typo?

::xo::db::Attribute was another issue (related to xotcl2): the class is not from the xotcl class hierarchy, but from the nx hierarchy). I've adjusted the code the the newest version of nx, and installed this version on OpenACS.org.
Now it is visible (that should be a transitional issue).

Concerning changing tables: i tend to agree that adding columns is sage, but altering or deleting is not. Also when adding columns to existing tables, you might have some problems with existing tuples. also doing this portable (PostgreSQL and oracle) is some more work since one has to query table properties and compare these with then intended changes. During development, it is usually not a big problem to drop the fresh tables frequently. Changing the tables for existing applications happens seldom enough and requires usually an update script.

yes, it is true, the index page is protected on OpenACS.org, but its content is mostly generated. It is sufficient to edit the page containing the xotcl info, here xotcl-core.

all the best
-g

[1] http://openacs.org/api-doc/proc-view?proc=xo%3a%3adb%3a%3aselect_driver&source_p=1

Collapse
Posted by Antonio Pisano on
Ok, I've found it, didn't look for xo::db::select_driver without trailing semicolons, sorry.

I've just refreshed my installation to freshest cvs (upgrading everything from apm) and now /xotcl page gives me a complain:

unable to dispatch sub-method "superclasses" of ::nx::BootStrapVariableSlot info; valid are: info children, info class, info configure, info configure defaultmethod, info configure parameters, info configure syntax, info filter guard, info filter methods, info has mixin, info has namespace, info has type, info heritage, info info, info instances, info lookup configure parameters, info lookup configure syntax, info lookup filter, info lookup method, info lookup methods, info lookup slots, info lookup variables, info method args, info method body, info method definition, info method definitionhandle, info method exists, info method handle, info method origin, info method parameters, info method postcondition, info method precondition, info method registrationhandle, info method returns, info method submethods, info method syntax, info method type, info methods, info mixin classes, info mixin guard, info mixinof, info name, info object filter guard, info object filter methods, info object method args, info object method body, info object method definition, info object method definitionhandle, info object method exists, info object method handle, info object method origin, info object method parameters, info object method postcondition, info object method precondition, info object method registrationhandle, info object method returns, info object method submethods, info object method syntax, info object method type, info object methods, info object mixin classes, info object mixin guard, info object slots, info object variables, info parameter default, info parameter name, info parameter syntax, info parameter type, info parent, info precedence, info slots, info subclass, info superclass, info variable definition, info variable name, info variable parameter, info variables, info vars
while executing
"error "unable to dispatch sub-method $ref; valid are: [join [lsort $valid] {, }]""
(procedure "unknown" line 11)
::nx::Class::slot::__info ::nx::EnsembleObject->unknown
::nx::BootStrapVariableSlot ::nx::Class->info
invoked from within
"$o info superclasses"
(procedure "::xo::getObjectProperty" line 45)
invoked from within
"::xo::getObjectProperty $cl $key"
(procedure "info_classes" line 4)
invoked from within
"info_classes $cl superclass"
("foreach" body line 6)
invoked from within
"foreach cl [lsort $classes] {
if {!$all_classes && [string match "::xotcl::*" $cl]} continue

append output "

  • [::xotcl::api..."
    ("uplevel" body line 60)
    invoked from within
    "uplevel {
    ad_page_contract {
    Show classes defined in the connection threads
  • Collapse
    Posted by Antonio Pisano on
    Seems like somehing in nx framework is missing, if I am not wrong. ::xo::db::Attribute was working, so some nx must be there already, but maybe there is something else I need to enable...
    Collapse
    Posted by Gustaf Neumann on
    Antonio, please get the newest version of nsf/nx from git and recompile+install it to get the xotcl class browser with the newest version of xotcl-core working on your local instance (e.g. use the HEAD option for xotcl in install-ns.sh). Most of the other stuff is robust against the latest changes, but the detailed introspection is not).

    The head version of nsf/nx/xotcl2 will be released quite soon.

    Collapse
    Posted by Antonio Pisano on
    Ok, fine with that.

    There is something else that I still can't figure:
    In apy doc, if i look at ::xo::db::sql::acs_attribute I get in the source code something that seems it has been auto-generated.

    api-doc states that such method is defined in packages/xotcl-core/tcl/05-db-procs.tcl, but I can't grasp how: the code I can find there calls such proc, but the real definition seems to come from somewere else.

    Collapse
    Posted by Gustaf Neumann on
    xotcl-core generates at startup automatically interfaces to all stored procedures in the database. For every package (in the oracle terminology) an object in the ::xo::db::sql namespace is generated. By calling e.g.
    ::xo::db::sql::acs_attribute create_attribute
    one is calling actually in an postgres installation the stored procedure
    acs_attribute__create_attribute
    This interface is much faster than the usual OpenACS interface and allows to handle defaults for attribtues, give error messages about expected attributes, etc.

    btw, i've updated xotcl-core once more, it should be now more backwards compatible (not tested), so you might not have to update nsf/nx.

    all the best
    -gn