コード例 #1
0
ファイル: utility.py プロジェクト: PMR2/pmr2.citations
    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)]
コード例 #2
0
ファイル: utility.py プロジェクト: PMR2/pmr2.citations
    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)]
コード例 #3
0
ファイル: utility.py プロジェクト: PMR2/pmr2.citations
 def _export(self, citation):
     names = ICitation.names()
     result = {}
     for k in names:
         result[k] = getattr(citation, k, None)
     return result
コード例 #4
0
ファイル: utility.py プロジェクト: PMR2/pmr2.citations
 def _export(self, citation):
     names = ICitation.names()
     result = {}
     for k in names:
         result[k] = getattr(citation, k, None)
     return result