<commit_before>from colander import Length
from deform import Form
from deform.widget import TextAreaWidget
from ekklesia_portal.helper.contract import Schema, string_property
from ekklesia_portal.helper.translation import _


class ArgumentSchema(Schema):
    title = string_property(title=_('title'), validator=Length(min=5, max=80))
    abstract = string_property(title=_('abstract'), validator=Length(min=5, max=140))
    details = string_property(title=_('details'), validator=Length(min=10, max=4096), missing='')


argument_widgets = {
    'abstract': TextAreaWidget(rows=2),
    'details': TextAreaWidget(rows=4)
}<commit_msg>Add maxlength to argument form title and abstract<commit_after>from colander import Length
from deform import Form
from deform.widget import TextAreaWidget, TextInputWidget
from ekklesia_portal.helper.contract import Schema, string_property
from ekklesia_portal.helper.translation import _


TITLE_MAXLENGTH = 80
ABSTRACT_MAXLENGTH = 160


class ArgumentSchema(Schema):
    title = string_property(title=_('title'), validator=Length(min=5, max=TITLE_MAXLENGTH))
    abstract = string_property(title=_('abstract'), validator=Length(min=5, max=ABSTRACT_MAXLENGTH))
    details = string_property(title=_('details'), validator=Length(min=10, max=4096), missing='')


argument_widgets = {
    'title': TextInputWidget(attributes={'maxlength': TITLE_MAXLENGTH}),
    'abstract': TextAreaWidget(rows=2, attributes={'maxlength': ABSTRACT_MAXLENGTH}),
    'details': TextAreaWidget(rows=4)
}
{'fraction_non_alphanumeric': 0.11609498680738786, 'fraction_numerical': 0.01978891820580475, 'mean_word_length': 7.619318181818182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5010053', 'n_tokens_mistral': 468, 'n_tokens_neox': 452, 'n_words': 97}