def _populateChannels(self, channels): l = [] for channel in channels: dict = {'label' : channel} obj = Channel() obj.populate(dict) l.append(obj) self['channels'] = l
def preprocess(self): for content_source in self.batch: # Link back content sources to channel objects to subscribe them to existing channels right after import if 'channels' in content_source and content_source['channels'] is not None: for channel_label in content_source['channels']: if channel_label not in self.channels_to_link: db_channel = channel_info(channel_label) channel_obj = Channel() channel_obj.id = db_channel['id'] channel_obj['content-sources'] = [] self.channels_to_link[channel_label] = channel_obj self.channels_to_link[channel_label]['content-sources'].append(content_source)