コード例 #1
0
ファイル: __init__.py プロジェクト: middlestate/nova-ideo
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.')
コード例 #2
0
 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
コード例 #3
0
ファイル: challenge.py プロジェクト: middlestate/nova-ideo
 def __init__(self, **kwargs):
     super(Challenge, self).__init__(**kwargs)
     self.set_data(kwargs)
     self.addtoproperty('channels', Channel())
     self.urls = PersistentDict({})
コード例 #4
0
 def __init__(self, **kwargs):
     super(Proposal, self).__init__(**kwargs)
     self.set_data(kwargs)
     self._amendments_counter = 1
     self.addtoproperty('channels', Channel())
コード例 #5
0
 def init_channels(self):
     if not self.general_chanel:
         self.addtoproperty('channels', Channel(title=_("General")))
         self.setproperty('general_chanel', self.channels[0])
コード例 #6
0
 def __init__(self, **kwargs):
     super(Amendment, self).__init__(**kwargs)
     self.explanations = PersistentDict()
     self.set_data(kwargs)
     self.addtoproperty('channels', Channel())