Forum OpenACS Development: Re: title attribute in both acs_objects and cr_revisions

Collapse
Posted by Dave Bauer on
Stan,

The cr_revisioni view is where the acs_objects.title column i s aliased to object_title.

You need to special case acs_objects.title when it builds the list or columns to insert.

Here is how its done in the CR. We just skip all the attributes of content_revision (and by inheritance acs_object) since we _know_ what they are:

if { [exists_and_not_null attributes] } {
	set type_attributes [package_object_attribute_list $content_type]
	set valid_attributes [list]
	# add in extended attributes for this type, ingore
	# content_revision as those are already captured as named
	# parameters to this procedure

	foreach type_attribute $type_attributes {
	    if {![string equal "cr_revisions" [lindex $type_attribute 1]]} {
		lappend valid_attributes [lindex $type_attribute 2]
	    }
	}
	foreach attribute_pair $attributes {
            foreach {attribute_name attribute_value} $attribute_pair {break}
	    if {[lsearch $valid_attributes $attribute_name] > -1}  {

                # first add the column name to the list
		append attribute_names  ", ${attribute_name}"
		# create local variable to use for binding
		set $attribute_name $attribute_value
		append attribute_values ", :${attribute_name}"
	    }
	}
    }

So you could so the same thing but just skip acs_objects (and add those in manually).