fix maxlength test
gitea/wcs/pipeline/head There was a failure building this commit Details

This commit is contained in:
Frédéric Péters 2023-04-04 17:01:12 +02:00
parent fca535f2c0
commit 8253d20176
1 changed files with 4 additions and 0 deletions

View File

@ -676,6 +676,10 @@ class TextWidget(QuixoteTextWidget):
def _parse(self, request, use_validation_function=True):
QuixoteTextWidget._parse(self, request)
if self.value is not None:
try:
maxlength = int(self.attrs.get('maxlength', 0))
except (TypeError, ValueError):
maxlength = 0
if maxlength:
if len(self.value) > maxlength:
self.set_error('too_long')