def evolve_channels(root, registry): from novaideo.views.filter import find_entities from novaideo.content.interface import ( Iidea, IAmendment, IProposal, ICorrelation, IPerson) from novaideo.core import Channel root = getSite() general = root.channels[0] if root.channels else Channel(title=_("General")) root.addtoproperty('channels', general) root.setproperty('general_chanel', general) contents = find_entities( interfaces=[Iidea, IAmendment, IProposal, ICorrelation]) for entity in contents: if not entity.channel: entity.addtoproperty('channels', Channel()) channel = entity.channel for comment in entity.comments: channel.addtoproperty('comments', comment) users = find_entities( interfaces=[IPerson]) for member in users: selections = getattr(member, 'selections', []) for selection in selections: channel = getattr(selection, 'channel', None) if channel and member not in channel.members: channel.addtoproperty('members', member) log.info('Comments evolved.')
def __init__(self, **kwargs): super(Question, self).__init__(**kwargs) self.set_data(kwargs) self.addtoproperty('channels', Channel()) self.selected_options = OOBTree() self.users_options = OOBTree() self.urls = PersistentDict({}) self.len_answers = 0
def __init__(self, **kwargs): super(Challenge, self).__init__(**kwargs) self.set_data(kwargs) self.addtoproperty('channels', Channel()) self.urls = PersistentDict({})
def __init__(self, **kwargs): super(Proposal, self).__init__(**kwargs) self.set_data(kwargs) self._amendments_counter = 1 self.addtoproperty('channels', Channel())
def init_channels(self): if not self.general_chanel: self.addtoproperty('channels', Channel(title=_("General"))) self.setproperty('general_chanel', self.channels[0])
def __init__(self, **kwargs): super(Amendment, self).__init__(**kwargs) self.explanations = PersistentDict() self.set_data(kwargs) self.addtoproperty('channels', Channel())