Example #1
0
    def test_compound_columns_metadata(self):
        # Both key and value of a compound_column are added to the metadata
        # if the key alone is added.

        new_type = self.new_temporary_type(behaviors=[IPerson.__identifier__])

        compound_columns = get_compound_columns()
        columns = [[key] for key in compound_columns]
        set_columns(new_type.lookupSchema(), columns)

        catalog = api.portal.get_tool(catalog_id)

        # the sets are completely different, the compound keys/values are not
        # part of the catalog columns
        self.assertFalse(
            set(compound_columns.keys()) & set(catalog._catalog.names)
        )
        self.assertFalse(
            set(compound_columns.values()) & set(catalog._catalog.names)
        )

        update_metadata(new_type)

        # the compound keys/values are a subset of the catalog columns
        self.assertTrue(
            set(compound_columns.keys()) <= set(catalog._catalog.names)
        )
        self.assertTrue(
            set(compound_columns.values()) <= set(catalog._catalog.names)
        )
Example #2
0
def update_metadata(fti):
    compound_columns = get_compound_columns()

    for column in get_columns(fti.lookupSchema()):
        for field in column:
            tools.add_attribute_to_metadata(field, catalog_id)

            if field in compound_columns:
                tools.add_attribute_to_metadata(
                    compound_columns[field], catalog_id)
Example #3
0
 def update(self):
     if self.has_people:
         self.renderer = Renderer(self.schema, redirects=get_compound_columns(), place="list")