From 07dc394cddf5dc734bc41b15ef2dfd58eca2e9b5 Mon Sep 17 00:00:00 2001 From: xiongchiamiov Date: Tue, 17 Nov 2015 12:43:12 -0800 Subject: [PATCH] POST_compose: use validator's 'required' parameter We're just ignoring the error that gets set, so we might as well have it not set that error in the first place if we don't care about it. --- r2/r2/controllers/api.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index 2befd007e..83ecf7e4c 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -328,7 +328,7 @@ class ApiController(RedditController): VCaptcha(), VUser(), VModhash(), - from_sr=VSRByName('from_sr'), + from_sr=VSRByName('from_sr', required=False), to=VMessageRecipient('to'), subject=VLength('subject', 100, empty_error=errors.NO_SUBJECT), body=VMarkdownLength(['text', 'message'], max_length=10000), @@ -369,8 +369,6 @@ class ApiController(RedditController): if from_sr and from_sr._spam: return - c.errors.remove((errors.BAD_SR_NAME, "from_sr")) - if from_sr: if not from_sr.is_moderator_with_perms(c.user, "mail"): abort(403)