Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

wiki: Ensure wiki page not found gives a 404. #699

Closed
wants to merge 2 commits into from

2 participants

Andre d Neil Williams
Andre d

Fixes #657 and #658

Andre d

Updated to fix #658

r2/r2/controllers/wiki.py
@@ -105,9 +105,15 @@ def GET_wiki_page(self, pv, page_name):
page, version, version2 = pv
if not page:
- if c.render_style in extensions.API_TYPES:
- self.handle_error(404, 'PAGE_NOT_CREATED')
- return WikiNotFound(page=page_name).render()
+ api = c.render_style in extensions.API_TYPES
Neil Williams Owner
spladug added a note

how about is_api for the variable name?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Neil Williams
Owner

:nail_care:

Neil Williams
Owner

:fish:

Andre d andre-d closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 3 deletions.
  1. +9 −3 r2/r2/controllers/wiki.py
12 r2/r2/controllers/wiki.py
View
@@ -105,9 +105,15 @@ def GET_wiki_page(self, pv, page_name):
page, version, version2 = pv
if not page:
- if c.render_style in extensions.API_TYPES:
- self.handle_error(404, 'PAGE_NOT_CREATED')
- return WikiNotFound(page=page_name).render()
+ is_api = c.render_style in extensions.API_TYPES
+ if this_may_revise():
+ if is_api:
+ self.handle_error(404, 'PAGE_NOT_CREATED')
+ errorpage = WikiNotFound(page=page_name)
+ request.environ['usable_error_content'] = errorpage.render()
+ elif is_api:
+ self.handle_error(404, 'PAGE_NOT_FOUND')
+ self.abort404()
if version:
edit_by = version.get_author()
Something went wrong with that request. Please try again.