0001-forms-always-strip-submitted-strings-24289.patch
tests/test_widgets.py | ||
---|---|---|
89 | 89 |
assert widget.parse() == 'bar' |
90 | 90 | |
91 | 91 | |
92 |
def test_stringwidget_strip(): |
|
93 |
widget = StringWidget('test', value='foo') |
|
94 |
mock_form_submission(req, widget, {'test': ' bar '}) |
|
95 |
assert widget.parse() == 'bar' |
|
96 | ||
97 | ||
92 | 98 |
def test_stringwidget_required(): |
93 | 99 |
widget = StringWidget('test', value='foo', required=True) |
94 | 100 |
mock_form_submission(req, widget, {'test': ''}) |
wcs/qommon/form.py | ||
---|---|---|
536 | 536 | |
537 | 537 |
def _parse(self, request): |
538 | 538 |
quixote.form.StringWidget._parse(self, request) |
539 |
if self.value: |
|
540 |
self.value = self.value.strip() |
|
539 | 541 |
if self.value and self.validation_function: |
540 | 542 |
try: |
541 | 543 |
self.validation_function(self.value) |
542 |
- |