Example #1
0
def get_vocabulary_representants_upc(context):
    catalog = getSite().portal_catalog
    reporter = CarrecDataReporter(catalog)

    vocabulary_terms = []
    # Get representants from Consell de Direcció
    vocabulary_terms.append(
        SimpleTerm(title="Consell de direcció:", value="consell-de-direccio", token="consell-de-direccio")
    )
    vocabulary_terms += [
        SimpleTerm(
            title=" - " + prettify_representant(representant).encode("utf-8"),
            value=prettify_representant(representant),
            token=representant.getRID(),
        )
        for representant in reporter.list_representants("consell-de-direccio")
    ]

    # Get representants from Altres
    vocabulary_terms.append(SimpleTerm(title="Altres:", value="altres", token="altres"))
    vocabulary_terms += [
        SimpleTerm(
            title=" - " + prettify_representant(representant).encode("utf-8"),
            value=prettify_representant(representant),
            token=representant.id,
        )
        for representant in reporter.list_representants("altres")
    ]

    return SimpleVocabulary(vocabulary_terms)
Example #2
0
 def search(self):
     reporter = CarrecDataReporter(
         getToolByName(self.context, 'portal_catalog'))
     return reporter.search(self.parse_search_filters())