From 09b0be25833486c5fe3226f8090474d80eff3b6b Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Wed, 5 Dec 2012 12:38:00 -0800 Subject: [PATCH] Add maxlength attribute to submit form title field. --- r2/r2/controllers/validator/validator.py | 5 +++-- r2/r2/templates/newlink.html | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/r2/r2/controllers/validator/validator.py b/r2/r2/controllers/validator/validator.py index dc194a92d..248a4db3f 100644 --- a/r2/r2/controllers/validator/validator.py +++ b/r2/r2/controllers/validator/validator.py @@ -529,8 +529,9 @@ class VPrintable(VLength): class VTitle(VLength): - def __init__(self, param, max_length = 300, **kw): - VLength.__init__(self, param, max_length, **kw) + max_length = 300 + def __init__(self, param, **kw): + VLength.__init__(self, param, self.max_length, **kw) def param_docs(self): return { diff --git a/r2/r2/templates/newlink.html b/r2/r2/templates/newlink.html index 9e49d0b95..c96fa477d 100755 --- a/r2/r2/templates/newlink.html +++ b/r2/r2/templates/newlink.html @@ -24,6 +24,7 @@ from r2.lib.strings import strings from r2.lib.pages import UserText from r2.lib.template_helpers import add_sr + from r2.controllers.validator import VTitle %> <%namespace file="utils.html" import="error_field, submit_form, _a_buffered, reddit_selector, text_with_links"/> @@ -59,7 +60,7 @@ ${thing.formtabs_menu}
<%utils:round_field title="${_('title')}" id="title-field"> - + ${error_field("NO_TEXT", "title", "div")} ${error_field("TOO_LONG", "title", "div")}