def afterSetUp(self): addNyForum( self.portal, id='forum_id', title='myforum', categories=['Test category', 'Test category 2'], description='Description 1', file_max_size='15', ) forum = self.portal.forum_id myfile = StringIO('some test data') myfile.filename = 'the_file.txt' addNyForumTopic(forum, id='topic_id', title='topic title', category='Test category', description='Test Description', attachment=myfile, sort_reverse=True, ) topic = forum.topic_id addNyForumMessage(topic, id='message_id', title='Message title', description='Message Description', attachment=myfile, ) message = topic.message_id message.replyMessage(title='Reply to message_id', description='Reply message description', attachment=myfile, ) transaction.commit()
def afterSetUp(self): self._notifications = [] divert_notifications(True, self._notifications) addNyForum(self.portal, id="tforum", title="My Forum") tforum = self.portal["tforum"] addNyForumTopic(tforum, id="ttopic", title="My Topic") addNyForumMessage(tforum["ttopic"], id="tmessage", title="My Message") notif_tool = self.portal.getNotificationTool() notif_tool.config["enable_instant"] = True notif_tool.config["enable_weekly"] = True notif_tool.add_account_subscription("contributor", "tforum", "instant", "en") notif_tool.add_account_subscription("contributor", "tforum", "weekly", "en") transaction.commit()
def afterSetUp(self): self._notifications = [] divert_notifications(True, self._notifications) addNyForum(self.portal, id='tforum', title='My Forum') tforum = self.portal['tforum'] addNyForumTopic(tforum, id='ttopic', title='My Topic') addNyForumMessage(tforum['ttopic'], id='tmessage', title='My Message') notif_tool = self.portal.getNotificationTool() notif_tool.config['enable_instant'] = True notif_tool.config['enable_weekly'] = True notif_tool.add_account_subscription('contributor', 'tforum', 'instant', 'en') notif_tool.add_account_subscription('contributor', 'tforum', 'weekly', 'en') transaction.commit()
def loadDefaultData(self, load_glossaries=[], skel_handler=None): """ """ # set default 'Naaya' configuration NySite.__dict__['createPortalTools'](self) NySite.__dict__['loadDefaultData'](self) # remove Naaya default content layout_tool = self.getLayoutTool() naaya_skins = [skin.getId() for skin in layout_tool.objectValues('Naaya Skin')] logos = [image.getId() for image in layout_tool.objectValues('Image')] layout_tool.manage_delObjects(naaya_skins + logos) # load site skeleton - configuration if skel_handler is not None: self._load_skel_from_handler(skel_handler) # set default PhotoFolder addNyPhotoGallery(self, id='PhotoGallery', title=TITLE_PHOTOARCHIVE) self._getOb('PhotoGallery').approveThis() # create and configure LinkChecker instance manage_addLinkChecker(self, ID_LINKCHECKER, TITLE_LINKCHECKER) linkchecker_ob = self._getOb(ID_LINKCHECKER) linkchecker_ob.manage_edit(proxy='', batch_size=10, catalog_name=ID_CATALOGTOOL) linkchecker_ob.manage_addMetaType(METATYPE_NYURL) linkchecker_ob.manage_addProperty(METATYPE_NYURL, 'locator') for k, v in self.get_content_urls().items(): linkchecker_ob.manage_addMetaType(k) for p in v: linkchecker_ob.manage_addProperty(k, p) # set default main topics self.getPropertiesTool().manageMainTopics(['convention', 'cooperation', 'network', 'information']) # create NaayaCalendar instance manage_addEventCalendar( self, id="portal_calendar", title='Calendar of Events', description='', day_len='2', start_day='Monday', catalog=self.getCatalogTool().id, REQUEST=None) calendar = self._getOb('portal_calendar') calendar.cal_meta_types = calendar.setCalMetaTypes('Naaya Event') # create index for Naaya Calendar extra = Extra_for_DateRangeIndex(since_field='start_date', until_field='end_date') self.getCatalogTool().manage_addIndex("resource_interval", 'DateRangeIndex', extra=extra) # create and fill glossaries if 'coverage' in load_glossaries: self.add_glossary_coverage() if 'keywords' in load_glossaries: self.add_glossary_keywords() if 'chm_terms' in load_glossaries: self.add_chm_terms_glossary() # set glossary for pick lists self._p_changed = 1 # add Forum instance addNyForum(self, id='portal_forum', title='CHM Forum', description='', categories=['CHM', 'Biodiversity', 'Other'], file_max_size=0, REQUEST=None) # add EC CHM to network portals list self.admin_addnetworkportal('EC CHM', 'http://biodiversity-chm.eea.europa.eu/') # enable some notifications self['portal_notification'].config['enable_monthly'] = True portal_layout = self['portal_layout'] if 'chm3' in portal_layout.objectIds(): portal_layout['chm3']._setProperty('main_section_image_size', '978x75') portal_layout['chm3']._setProperty('slider_image_size', '978x240')
def loadDefaultData(self, load_glossaries=[], skel_handler=None): """ """ #set default 'Naaya' configuration NySite.__dict__['createPortalTools'](self) NySite.__dict__['loadDefaultData'](self) #remove Naaya default content layout_tool = self.getLayoutTool() naaya_skins = [ skin.getId() for skin in layout_tool.objectValues('Naaya Skin') ] logos = [image.getId() for image in layout_tool.objectValues('Image')] layout_tool.manage_delObjects(naaya_skins + logos) #load site skeleton - configuration if skel_handler is not None: self._load_skel_from_handler(skel_handler) #set default PhotoFolder addNyPhotoGallery(self, id='PhotoGallery', title=TITLE_PHOTOARCHIVE) self._getOb('PhotoGallery').approveThis() #create and configure LinkChecker instance manage_addLinkChecker(self, ID_LINKCHECKER, TITLE_LINKCHECKER) linkchecker_ob = self._getOb(ID_LINKCHECKER) linkchecker_ob.manage_edit(proxy='', batch_size=10, catalog_name=ID_CATALOGTOOL) linkchecker_ob.manage_addMetaType(METATYPE_NYURL) linkchecker_ob.manage_addProperty(METATYPE_NYURL, 'locator') for k, v in self.get_content_urls().items(): linkchecker_ob.manage_addMetaType(k) for p in v: linkchecker_ob.manage_addProperty(k, p) #set default main topics self.getPropertiesTool().manageMainTopics( ['convention', 'cooperation', 'network', 'information']) #create NaayaCalendar instance manage_addEventCalendar(self, id="portal_calendar", title='Calendar of Events', description='', day_len='2', start_day='Monday', catalog=self.getCatalogTool().id, REQUEST=None) calendar = self._getOb('portal_calendar') calendar.cal_meta_types = calendar.setCalMetaTypes('Naaya Event') #create index for Naaya Calendar extra = Extra_for_DateRangeIndex(since_field='start_date', until_field='end_date') self.getCatalogTool().manage_addIndex("resource_interval", 'DateRangeIndex', extra=extra) #create and fill glossaries if 'coverage' in load_glossaries: self.add_glossary_coverage() if 'keywords' in load_glossaries: self.add_glossary_keywords() if 'chm_terms' in load_glossaries: self.add_chm_terms_glossary() #set glossary for pick lists self._p_changed = 1 #add Forum instance addNyForum(self, id='portal_forum', title='CHM Forum', description='', categories=['CHM', 'Biodiversity', 'Other'], file_max_size=0, REQUEST=None) #add EC CHM to network portals list self.admin_addnetworkportal('EC CHM', 'http://biodiversity-chm.eea.europa.eu/') # enable some notifications self['portal_notification'].config['enable_monthly'] = True portal_layout = self['portal_layout'] if 'chm3' in portal_layout.objectIds(): portal_layout['chm3']._setProperty('main_section_image_size', '978x75') portal_layout['chm3']._setProperty('slider_image_size', '978x240')