You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As part of the investigation of #464, #464 (comment) reminded of the existence of omeroweb.custom_forms.NonASCIIForm which is used as the superclass of several forms of webclient and webadmin.
This class simply extends django.forms.Form and overrides the full_clean method which is invoked when calling Form.is_valid:
Our custom form was introduced over a decade ago in ccd4c05 in order to address encoding errors with non ASCII characters. Since then, Unicode support of Unicode has changed a lot both with Python 3.x and recent versions of Django and should be much more native. We should review whether our logic is still necessary and if not, deprecate the class and update all forms to directly subclass django.forms.Form.
The text was updated successfully, but these errors were encountered:
As part of the investigation of #464, #464 (comment) reminded of the existence of
omeroweb.custom_forms.NonASCIIForm
which is used as the superclass of several forms ofwebclient
andwebadmin
.This class simply extends
django.forms.Form
and overrides thefull_clean
method which is invoked when callingForm.is_valid
:omero-web/omeroweb/custom_forms.py
Lines 34 to 82 in c706c42
is largely a copy of the upstream implementation which logic is split into several internal methods
_clean_fields()
,_clean_form()
and_post_clean()
- see https://github.com/django/django/blob/ca5d3c99efb1bcf181e923dcd00c4679ab6174ef/django/forms/forms.py#L314-L412and https://github.com/django/django/blob/722e9f8a38f5b34f2423059a75f8a59bb8eb931a/django/forms/forms.py#L306-L351.
The primary divergence is the special logic associated with the validation of
CharField
omero-web/omeroweb/custom_forms.py
Lines 58 to 66 in c706c42
It is worth noting that the implementation of these validation methods has changed upstream between 3.2 and 4.2 - see https://github.com/django/django/blob/fea17b76150688056d78818ea1ef47f1122dc165/django/forms/forms.py#L437-L451 for instance. So at minimum, these changes will need to be reviewed in the context of the upgrade of OMERO.web to Django 4.2 LTS.
Our custom form was introduced over a decade ago in ccd4c05 in order to address encoding errors with non ASCII characters. Since then, Unicode support of Unicode has changed a lot both with Python 3.x and recent versions of Django and should be much more native. We should review whether our logic is still necessary and if not, deprecate the class and update all forms to directly subclass
django.forms.Form
.The text was updated successfully, but these errors were encountered: