From 57fb1edd3ff402251b080fec0431ecb4ab7f7627 Mon Sep 17 00:00:00 2001 From: Andre D Date: Thu, 13 Sep 2012 02:55:05 -0500 Subject: [PATCH] Subreddit: Handle previous revision failures --- r2/r2/controllers/api.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 428ac2a8d..f87d33b47 100755 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1255,6 +1255,12 @@ class ApiController(RedditController, OAuth2ResourceController): form.set_html('#conflict_diff', e.htmldiff) form.find('.errors').show() return + except ValueError: + # Revision does not belong to page + return + except tdb_cassandra.NotFound: + # Previous revision not found + return jquery.apply_stylesheet(stylesheet_contents_parsed) if op == 'preview': # try to find a link to use, otherwise give up and @@ -1467,6 +1473,12 @@ class ApiController(RedditController, OAuth2ResourceController): form.find('#%s_conflict_box' % field).show() form.set_inputs(**{'prev_%s_id' % field: e.new_id, '%s_conflict_old' % field: e.your, field: e.new}) form.set_html('#%s_conflict_diff' % field, e.htmldiff) + except ValueError: + # Revision does not belong to page + pass + except tdb_cassandra.NotFound: + # Previous revision not found + pass return False # the status button is outside the form -- have to reset by hand