def find_citations(self, container): """\ Find all citation objects within container. """ # XXX when the raw values are indexed correctly, portal_catalog # might be a better way, for now we skip this. # # try: # catalog = getToolByName(container, 'portal_catalog') # except AttributeError: # return [i for i in container.values() if ICitation.providedBy(i)] # # brains = catalog(portal_type='Citation') # # perhaps use a generator? # return [i.getObject() for i in self._catalog(brains)] # and just do this... return [i for i in container.values() if ICitation.providedBy(i)]
def _export(self, citation): names = ICitation.names() result = {} for k in names: result[k] = getattr(citation, k, None) return result