Revert page to a previeous version (Requires login) (UNTESTED).

        Parameters:
            wiki_page_id (int): Where page_id is the wiki page id.
            version_id (int):
978634
def wiki_revert(self, wiki_page_id, version_id):
        
        return self._get('wiki_pages/{0}/revert.json'.format(wiki_page_id),
                         {'version_id': version_id}, method='PUT', auth=True)
633480
def post_revert(self, post_id, version_id):
        
        return self._get('posts/{0}/revert.json'.format(post_id),
                         {'version_id': version_id}, 'PUT', auth=True)
614644
def delete_page_full(id):
    

    children = _json.loads(get_page_children(id))

    for i in children["results"]:
        delete_page_full(i["id"])

    return delete_page(id)
1246988
def remove_page(self, process_id, wit_ref_name, page_id):
        
        route_values = {}
        if process_id is not None:
            route_values['processId'] = self._serialize.url('process_id', process_id, 'str')
        if wit_ref_name is not None:
            route_values['witRefName'] = self._serialize.url('wit_ref_name', wit_ref_name, 'str')
        if page_id is not None:
            route_values['pageId'] = self._serialize.url('page_id', page_id, 'str')
        self._send(http_method='DELETE',
                   location_id='1cc7b29f-6697-4d9d-b0a1-2650d3e1d584',
                   version='5.0-preview.1',
                   route_values=route_values)
1059059
def page_url(self, page):
        '''
        
        '''
        if page is not None and page != 1:
            return self.url.qs_set(**{self.page_param: page})
        elif page is not None:
            return self.url.qs_delete('page')
251573
def refresh(self):
        '''
        
        '''
        kwd = {
            'pager': '',
            'title': '最近文档',
        }
        self.render('wiki_page/wiki_list.html',
                    view=MWiki.query_dated(16),
                    format_date=tools.format_date,
                    kwd=kwd,
                    userinfo=self.userinfo)
86550
def __load(self, redirect=True, preload=False):
    '''
    
    '''
    query_params = {
      'prop': 'info|pageprops',
      'inprop': 'url',
      'ppprop': 'disambiguation',
      'redirects': '',
    }
    if not getattr(self, 'pageid', None):
      query_params['titles'] = self.title
    else:
      query_params['pageids'] = self.pageid

    request = _wiki_request(query_params)

    query = request['query']
    pageid = list(query['pages'].keys())[0]
    page = query['pages'][pageid]

    # missing is present if the page is missing
    if 'missing' in page:
      if hasattr(self, 'title'):
        raise PageError(self.title)
      else:
        raise PageError(pageid=self.pageid)

    # same thing for redirect, except it shows up in query instead of page for
    # whatever silly reason
    elif 'redirects' in query:
      if redirect:
        redirects = query['redirects'][0]

        if 'normalized' in query:
          normalized = query['normalized'][0]
          assert normalized['from'] == self.title, ODD_ERROR_MESSAGE

          from_title = normalized['to']

        else:
          from_title = self.title

        assert redirects['from'] == from_title, ODD_ERROR_MESSAGE

        # change the title and reload the whole object
        self.__init__(redirects['to'], redirect=redirect, preload=preload)

      else:
        raise RedirectError(getattr(self, 'title', page['title']))

    # since we only asked for disambiguation in ppprop,
    # if a pageprop is returned,
    # then the page must be a disambiguation page
    elif 'pageprops' in page:
      query_params = {
        'prop': 'revisions',
        'rvprop': 'content',
        'rvparse': '',
        'rvlimit': 1
      }
      if hasattr(self, 'pageid'):
        query_params['pageids'] = self.pageid
      else:
        query_params['titles'] = self.title
      request = _wiki_request(query_params)
      html = request['query']['pages'][pageid]['revisions'][0]['*']

      lis = BeautifulSoup(html, 'html.parser').find_all('li')
      filtered_lis = [li for li in lis if not 'tocsection' in ''.join(li.get('class', []))]
      may_refer_to = [li.a.get_text() for li in filtered_lis if li.a]

      raise DisambiguationError(getattr(self, 'title', page['title']), may_refer_to)

    else:
      self.pageid = pageid
      self.title = page['title']
      self.url = page['fullurl']
87103
def revisionId(self):
        
        log.warning("'RevisionId' requested, ensure that you are don't need 'id'")
        revision_id = self.json()['revisionId']
        assert revision_id == self.id, "RevisionId differs id-{}!=revisionId-{}".format(self.id, revision_id)
        return revision_id
503680
function revertInit(reinit, list, prefix, name, currentVersion) {
    exec('rm -Rf ./.versionFilesList.json', function(error, stdout, stderr) {
        if (error) sendProcessError(stdout, stderr);

        print('Deleted previous .versionFilesList.json', 'important', 'date');
        if (reinit) init(list, prefix, name, currentVersion);
    });
}
68339
def delete_extension_by_id(self, extension_id, version=None):
        
        route_values = {}
        if extension_id is not None:
            route_values['extensionId'] = self._serialize.url('extension_id', extension_id, 'str')
        query_parameters = {}
        if version is not None:
            query_parameters['version'] = self._serialize.query('version', version, 'str')
        self._send(http_method='DELETE',
                   location_id='a41192c8-9525-4b58-bc86-179fa549d80d',
                   version='5.0-preview.2',
                   route_values=route_values,
                   query_parameters=query_parameters)
1256827
def revert(self, version, url):
        
        message = "Draft replaced with %s version. This revert has not been published." % version.date_published
        version.make_draft()

        # Log action as a save
        self.log_action(self.object, CMSLog.SAVE, url=url)
        return self.write_message(message=message)
189038
def remove_content_history_in_cloud(self, page_id, version_id):
        
        url = 'rest/api/content/{id}/version/{versionId}'.format(id=page_id, versionId=version_id)
        self.delete(url)
869248
def wiki_page(name, path = nil, version = nil, exact = true)
      wiki = wiki_new
      path = name if path.nil?
      name = extract_name(name) || wiki.index_page
      path = extract_path(path)
      path = '/' if exact && path.nil?

      OpenStruct.new(:wiki => wiki, :page => wiki.paged(name, path, exact, version),
                     :name => name, :path => path)
    end
730214
def delete_version(self, version_id=None):
        
        if not version_id:
            version_id = self.version.id

        target_url = self._client.get_url('VERSION', 'DELETE', 'single', {'layer_id': self.id, 'version_id': version_id})
        r = self._client.request('DELETE', target_url)
        logger.info("delete_version(): %s", r.status_code)
273875
def revert(self):
        """"""

        with self.draft_context():
            draft = self.one(Q._uid == self._uid)

        with self.published_context():
            published = self.one(Q._uid == self._uid)

        for field, value in draft._document.items():
            if field in self._unpublished_fields:
                continue
            setattr(draft, field, getattr(published, field))

        # Revert the revision
        draft.revision = published.revision

        draft.update()
1141468
def page_revisions(request, page_id, template_name='wagtailrollbacks/edit_handlers/revisions.html'):
    
    page        = get_object_or_404(Page, pk=page_id)
    page_perms  = page.permissions_for_user(request.user)

    if not page_perms.can_edit():
        raise PermissionDenied

    page_num    = request.GET.get('p', 1)
    revisions   = get_revisions(page, page_num)

    return render(
        request,
        template_name,
        {
            'page':         page,
            'revisions':    revisions,
            'p':            page_num,
        }
    )
114239
def post_revert_tags(self, post_id, history_id):
        
        params = {'id': post_id, 'history_id': history_id}
        return self._get('post/revert_tags', params, 'PUT')