Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

wiki: Correct a failure when editing a page.

Occurs when the previous revision is hidden.
  • Loading branch information...
commit 0fbe7f63c360262b9e9353604d3c148a7bea5e0e 1 parent b020ee7
@andre-d andre-d authored spladug committed
View
6 r2/r2/controllers/validator/wiki.py
@@ -208,9 +208,11 @@ def run(self, page):
return (page, page != original_page)
class VWikiPage(VWikiPageName):
- def __init__(self, param, required=True, restricted=True, modonly=False, **kw):
+ def __init__(self, param, required=True, restricted=True, modonly=False,
+ allow_hidden_revision=True, **kw):
self.restricted = restricted
self.modonly = modonly
+ self.allow_hidden_revision = allow_hidden_revision
self.required = required
Validator.__init__(self, param, **kw)
@@ -254,7 +256,7 @@ def validversion(self, version, pageid=None):
return
try:
r = WikiRevision.get(version, pageid)
- if r.is_hidden and not c.is_wiki_mod:
+ if not self.allow_hidden_revision and (r.is_hidden and not c.is_wiki_mod):
self.set_error('HIDDEN_REVISION', code=403)
raise AbortWikiError
return r
View
2  r2/r2/controllers/wiki.py
@@ -76,7 +76,7 @@ class WikiController(RedditController):
allow_stylesheets = True
@wiki_validate(pv=VWikiPageAndVersion(('page', 'v', 'v2'), required=False,
- restricted=False),
+ restricted=False, allow_hidden_revision=False),
page_name=VWikiPageName('page'))
def GET_wiki_page(self, pv, page_name):
page, version, version2 = pv
Please sign in to comment.
Something went wrong with that request. Please try again.