def setupPeopleFolder(portal, out=None): """ set up the 'people' folder """ oldname = 'Members' newname = 'people' newtitle = 'People' print >> out, 'Setting up "%s" folder' % newname obj_ids = portal.objectIds() if oldname in obj_ids: print >> out, '-> Renaming "%s" -> "%s"' % (oldname, newname) folder = portal._getOb(oldname) fti = folder.getTypeInfo() changeback = False if not fti.global_allow: oldvalue = fti.global_allow changeback = True fti.global_allow = True portal.manage_renameObject(oldname, newname) folder.setTitle(newtitle) if changeback: fti.global_allow = oldvalue elif not newname in obj_ids: print >> out, '-> Creating "%s" folder' % newname ttool = getToolByName(portal, 'portal_types') ttool.constructContent('Large Plone Folder', portal, newname, title=newtitle) print >> out, '-> Setting "%s" as member area folder' % newname mtool = getToolByName(portal, 'portal_membership') mtool.setMembersFolderById(id=newname) if not mtool.getMemberareaCreationFlag(): print >> out, '-> Setting member area creation flag' mtool.setMemberareaCreationFlag() # mark the people folder with an interface pf = getattr(portal, 'people') if not IAmAPeopleFolder.providedBy(pf): alsoProvides(pf, IAmAPeopleFolder) try: from opencore.feed.interfaces import ICanFeed if not ICanFeed.providedBy(pf): alsoProvides(pf, ICanFeed) except ImportError: pass # set the default layout has_index = pf._getOb('index_html', None) if has_index: pf.manage_delObjects(['index_html']) pf.setDefaultPage(None) pf.setLayout('@@view')
def current_search_page(self): if IAmAPeopleFolder.providedBy(self.context): return 'people' if IAddProject.providedBy(self.context): return 'projects' return 'sitesearch'