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)
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 {}
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 {}
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)
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)
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)