コード例 #1
0
ファイル: comment.py プロジェクト: middlestate/nova-ideo
    def set_associated_contents(self, associated_contents, user):
        subject = self.subject
        current_associated_contents = self.associated_contents
        associated_contents_to_add = [
            i for i in associated_contents
            if i not in current_associated_contents
        ]
        associated_contents_to_del = [
            i for i in current_associated_contents
            if i not in associated_contents
            and i not in associated_contents_to_add
        ]
        correlations = connect(
            subject,
            associated_contents_to_add,
            {
                'comment': _('Add related contents'),
                'type': _('Edit the comment')
            },
            author=user,
        )
        for correlation in correlations:
            correlation.setproperty('context', self)

        disconnect(subject, associated_contents_to_del)
コード例 #2
0
ファイル: behaviors.py プロジェクト: ecreall/nova-ideo
    def start(self, context, request, appstruct, **kw):
        content = context.subject
        current_correlation = context.related_correlation
        if current_correlation:
            targets = getattr(current_correlation, 'targets', [])
            disconnect(content, targets)

        context.channel.remove_comment(context)
        context.__parent__.delfromproperty('comments', context)
        return {}
コード例 #3
0
    def start(self, context, request, appstruct, **kw):
        content = context.subject
        current_correlation = context.related_correlation
        if current_correlation:
            targets = getattr(current_correlation, 'targets', [])
            disconnect(content, targets)

        context.channel.remove_comment(context)
        context.__parent__.delfromproperty('comments', context)
        return {}
コード例 #4
0
ファイル: proposal.py プロジェクト: ecreall/KuneAgi
 def set_related_ideas(self, relatedideas, user):
     current_related_ideas = self.related_ideas
     related_ideas_to_add = [
         i for i in relatedideas if i not in current_related_ideas
     ]
     related_ideas_to_del = [
         i for i in current_related_ideas
         if i not in relatedideas and i not in related_ideas_to_add
     ]
     connect(self, related_ideas_to_add, {
         'comment': _('Add related ideas'),
         'type': _('Edit the proposal')
     }, user, ['related_proposals', 'related_ideas'], CorrelationType.solid,
             True)
     disconnect(self, related_ideas_to_del, 'related_ideas',
                CorrelationType.solid)
コード例 #5
0
ファイル: proposal.py プロジェクト: ecreall/nova-ideo
 def set_related_ideas(self, relatedideas, user):
     current_related_ideas = self.related_ideas
     related_ideas_to_add = [i for i in relatedideas
                             if i not in current_related_ideas]
     related_ideas_to_del = [i for i in current_related_ideas
                             if i not in relatedideas and
                             i not in related_ideas_to_add]
     connect(self,
             related_ideas_to_add,
             {'comment': _('Add related ideas'),
              'type': _('Edit the proposal')},
             user,
             ['related_proposals', 'related_ideas'],
             CorrelationType.solid,
             True)
     disconnect(self,
                related_ideas_to_del,
                'related_ideas',
                CorrelationType.solid)
コード例 #6
0
ファイル: question.py プロジェクト: ecreall/nova-ideo
    def set_associated_contents(self, associated_contents, user):
        subject = self.subject
        current_associated_contents = self.associated_contents
        associated_contents_to_add = [i for i in associated_contents
                                      if i not in current_associated_contents]
        associated_contents_to_del = [i for i in current_associated_contents
                                      if i not in associated_contents and
                                      i not in associated_contents_to_add]
        correlations = connect(
            subject,
            associated_contents_to_add,
            {'comment': _('Add related contents'),
             'type': _('Edit the comment')},
            author=user)
        for correlation in correlations:
            correlation.setproperty('context', self)

        disconnect(
            subject,
            associated_contents_to_del)