@must_not_be_registration
@must_have_permission('write')
@must_have_addon('wiki', 'node')
def project_wiki_rename(auth, wname, **kwargs):
 node = (kwargs['node'] or kwargs['project'])
 wiki_name = wname.strip()
 new_wiki_name = request.get_json().get('value', None)
 try:
  node.rename_node_wiki(wiki_name, new_wiki_name, auth)
 except NameEmptyError:
  raise WIKI_NAME_EMPTY_ERROR
 except NameInvalidError as error:
  raise HTTPError(http.BAD_REQUEST, data=dict(message_short='Invalid name', message_long=error.args[0]))
 except NameMaximumLengthError:
  raise WIKI_NAME_MAXIMUM_LENGTH_ERROR
 except PageCannotRenameError:
  raise WIKI_PAGE_CANNOT_RENAME_ERROR
 except PageConflictError:
  raise WIKI_PAGE_CONFLICT_ERROR
 except PageNotFoundError:
  raise WIKI_PAGE_NOT_FOUND_ERROR
 except ValidationError as err:
  raise HTTPError(http.BAD_REQUEST, data=dict(message_short='Invalid request', message_long=err.messages[0]))
 else:
  sharejs_uuid = wiki_utils.get_sharejs_uuid(node, new_wiki_name)
  wiki_utils.broadcast_to_sharejs('redirect', sharejs_uuid, node, new_wiki_name)

@ must_not_be_registration @ must_have_permission ( 'write' ) @ must_have_addon ( 'wiki' , 'node' ) def project_wiki_rename ( auth , wname , ** kwargs ) : node = ( kwargs [ 'node' ] or kwargs [ 'project' ] ) wiki_name = wname . strip ( ) new_wiki_name = request . get_json ( ) . get ( 'value' , None ) try : node . rename_node_wiki ( wiki_name , new_wiki_name , auth ) except NameEmptyError : raise WIKI_NAME_EMPTY_ERROR except NameInvalidError as error : raise HTTPError ( http . BAD_REQUEST , data = dict ( message_short = 'Invalid name' , message_long = error . args [ 0 ] ) ) except NameMaximumLengthError : raise WIKI_NAME_MAXIMUM_LENGTH_ERROR except PageCannotRenameError : raise WIKI_PAGE_CANNOT_RENAME_ERROR except PageConflictError : raise WIKI_PAGE_CONFLICT_ERROR except PageNotFoundError : raise WIKI_PAGE_NOT_FOUND_ERROR except ValidationError as err : raise HTTPError ( http . BAD_REQUEST , data = dict ( message_short = 'Invalid request' , message_long = err . messages [ 0 ] ) ) else : sharejs_uuid = wiki_utils . get_sharejs_uuid ( node , new_wiki_name ) wiki_utils . broadcast_to_sharejs ( 'redirect' , sharejs_uuid , node , new_wiki_name )
view that handles user the x-editable input for wiki page renaming .