diff --git a/r2/r2/controllers/errors.py b/r2/r2/controllers/errors.py index 1cfd51ef4..c215ffb97 100644 --- a/r2/r2/controllers/errors.py +++ b/r2/r2/controllers/errors.py @@ -55,7 +55,7 @@ error_list = dict(( ('USER_DOESNT_EXIST', _("that user doesn't exist")), ('NO_USER', _('please enter a username')), ('INVALID_PREF', "that preference isn't valid"), - ('BAD_NUMBER', _("that number isn't in the right range (%(min)d to %(max)d)")), + ('BAD_NUMBER', _("that number isn't in the right range (%(range)s)")), ('BAD_STRING', _("you used a character here that we can't handle")), ('BAD_BID', _("your bid must be at least $%(min)d per day and no more than to $%(max)d in total.")), ('ALREADY_SUB', _("that link has already been submitted")), diff --git a/r2/r2/controllers/validator/validator.py b/r2/r2/controllers/validator/validator.py index 947f265b6..7dba2b343 100644 --- a/r2/r2/controllers/validator/validator.py +++ b/r2/r2/controllers/validator/validator.py @@ -1184,8 +1184,15 @@ class VNumber(Validator): raise ValueError, "" return val except ValueError: - self.set_error(self.error, msg_params = dict(min=self.min, - max=self.max)) + if self.max is None and self.min is None: + range = "" + elif self.max is None: + range = _("%(min)d to any") % dict(min=self.min) + elif self.min is None: + range = _("any to %(max)d") % dict(max=self.max) + else: + range = _("%(min)d to %(max)d") % dict(min=self.min, max=self.max) + self.set_error(self.error, msg_params=dict(range=range)) class VInt(VNumber): def cast(self, val):