Пример #1
0
    def get_proposal(self):
        """Return the proposal to which this document belongs.

        This may return a "proposal" or a "submitted proposal".
        """
        parent = aq_parent(aq_inner(self))
        if IProposal.providedBy(parent):
            return parent

        # Find submitted proposal when self is an excerpt document in the
        # meeting dossier.
        for relation in getUtility(ICatalog).findRelations({
                'to_id': getUtility(IIntIds).getId(aq_inner(self)),
                'from_attribute': 'excerpts'}):
            # We expect that there are 0 or 1 relation, because this document
            # cannot be the excerpt of multiple proposals.
            submitted_proposal = relation.from_object
            if api.user.has_permission('View', obj=submitted_proposal):
                return submitted_proposal

        # Find proposal when self is an excerpt in the case dossier.
        generated_excerpts = GeneratedExcerpt.query.by_document(self).all()
        if generated_excerpts:
            proposal = generated_excerpts[0].proposal.resolve_proposal()
            if api.user.has_permission('View', obj=proposal):
                return proposal

        return None
Пример #2
0
    def scheduled_proposals(self, proposals):
        for proposal in proposals:
            if IProposal.providedBy(proposal):
                self._scheduled_proposals.append(proposal.load_model())
            else:
                self._scheduled_proposals.append(proposal)

        return self
Пример #3
0
    def get_parent_dossier(self):
        """Return the document's parent dossier.

        A parent dossier is available for documents in a dossier/subdossier
        or for documents in a task.

        No parent dossier is available for documents in an inbox, in a
        forwarding or inside a proposal. In that case this method returns None.

        """
        parent = aq_parent(aq_inner(self))
        if (IDossierMarker.providedBy(parent)
                or IDossierTemplateMarker.providedBy(parent)):
            return parent
        if ITask.providedBy(parent):
            return parent.get_containing_dossier()
        if IProposal.providedBy(parent):
            return parent.get_containing_dossier()

        return None
Пример #4
0
    def get_parent_dossier(self):
        """Return the document's parent dossier.

        A parent dossier is available for documents in a dossier/subdossier
        or for documents in a task.

        No parent dossier is available for documents in an inbox, in a
        forwarding or inside a proposal. In that case this method returns None.

        """
        parent = aq_parent(aq_inner(self))
        if IDossierMarker.providedBy(parent) or \
           IDossierTemplateMarker.providedBy(parent) or \
           ITemplateFolder.providedBy(parent):
            return parent
        if ITask.providedBy(parent):
            return parent.get_containing_dossier()
        if IProposal.providedBy(parent):
            return parent.get_containing_dossier()

        return None
Пример #5
0
 def is_inside_a_proposal(self):
     parent = aq_parent(aq_inner(self))
     return IProposal.providedBy(parent)
Пример #6
0
 def __call__(self, brain, index_data):
     obj = brain.getObject()
     if IProposal.providedBy(obj):
         return IProposal(obj).is_submit_additional_documents_allowed()
     return super(SubmittableProposalFilter,
                  self).__call__(brain, index_data)
Пример #7
0
 def __call__(self, brain, index_data):
     obj = brain.getObject()
     if IProposal.providedBy(obj):
         return IProposal(obj).is_submit_additional_documents_allowed()
     return super(SubmittableProposalFilter, self).__call__(
         brain, index_data)
Пример #8
0
 def is_inside_a_proposal(self):
     parent = aq_parent(aq_inner(self))
     return IProposal.providedBy(parent)