Forum OpenACS Development: Xotcl-core Customizing queries per subclass

I want to customize the select_instance_query and select_query instproc for a subclas of CrClass.

This does not seem to work.

If I define

SubClass ad_instproc select_instance_query {arg} {doc} { proc body}

it never gets called.

If I look at some code that calls this proc like this

$object_type instance_select_query

I should be able to call

SubClass select_instance_query and see the results of my instproc method on the SubClass. This doesn't work and it always shows the results of the instporc method of the superclass.

What am I doing wrong? It seems like these queries should be customizable for sub classes.

Collapse
Posted by Gustaf Neumann on
Dave,

instance_select_query is defined as a method of the meta-class CrClass (CrClass ad_instproc instance_select_query ... in generic.tcl).

Vocabulary: A meta class is to a class the same as a class to an object. The instances of a meta class are classes, the instances of classes are objects. Meta-classes are used to configure classes (sometimes called class factories) and to provide methods for classes.

Since instance_select_query is called on classes (and not on the instances of the classes, e.g. pages), defining an instproc for subclass is not correct (it provides methods for instances), but one can define a class specifc method SubClass ad_proc instance_select_query...

Clear?

Collapse
Posted by Dave Bauer on
Thanks Gustaf, I did not realize CrClass was a meta-class. From my experiments I realized that each sub class of CrClass was actually an instance of CrClass, but I guess I did not find the right page in the documentation.

Now I think I get it :)

the ad_instproc on my SubClass was available to instances of that class, not on the class itself. I changed to ad_proc and its working.