def _do_wiki_upgrade(self): """Move all wiki pages starting with Trac prefix to unbranded user guide pages. """ wiki_admin = WikiAdmin(self.env) pages = wiki_admin.get_wiki_list() for old_name in pages: if old_name.startswith('Trac'): new_name = wiki.new_name(old_name) if not new_name: continue if new_name in pages: printout( _( 'Ignoring %(page)s : ' 'The page %(new_page)s already exists', page=old_name, new_page=new_name)) continue try: wiki_admin._do_rename(old_name, new_name) except AdminCommandError, exc: printout( _('Error moving %(page)s : %(message)s', page=old_name, message=unicode(exc))) else: # On success, rename links in other pages self._do_wiki_rename_links(old_name, new_name) # On success, insert redirection page redirection = WikiPage(self.env, old_name) redirection.text = _('See [wiki:"%(name)s"].', name=new_name) comment = 'Bloodhound guide update' redirection.save('bloodhound', comment, '0.0.0.0')
def _do_wiki_upgrade(self): """Move all wiki pages starting with Trac prefix to unbranded user guide pages. """ wiki_admin = WikiAdmin(self.env) pages = wiki_admin.get_wiki_list() for old_name in pages: if old_name.startswith('Trac'): new_name = wiki.new_name(old_name) if not new_name: continue if new_name in pages: printout(_('Ignoring %(page)s : ' 'The page %(new_page)s already exists', page=old_name, new_page=new_name)) continue try: wiki_admin._do_rename(old_name, new_name) except AdminCommandError, exc: printout(_('Error moving %(page)s : %(message)s', page=old_name, message=unicode(exc))) else: # On success, rename links in other pages self._do_wiki_rename_links(old_name, new_name) # On success, insert redirection page redirection = WikiPage(self.env, old_name) redirection.text = _('See [wiki:"%(name)s"].', name=new_name) comment = 'Bloodhound guide update' redirection.save('bloodhound', comment, '0.0.0.0')
def new_name(name): new_name = wiki.new_name(name) if new_name != name: if not self._wiki_pages: wiki_admin = WikiAdmin(self.env) self._wiki_pages = wiki_admin.get_wiki_list() if new_name in self._wiki_pages: return new_name return name