0001-form-don-t-break-on-emails-with-empty-parts-in-domai.patch
tests/test_widgets.py | ||
---|---|---|
234 | 234 |
mock_form_submission(req, widget, {'test': 'foo@localhost@test'}) |
235 | 235 |
assert widget.has_error() |
236 | 236 | |
237 |
widget = EmailWidget('test') |
|
238 |
mock_form_submission(req, widget, {'test': 'foo@localhost..localdomain'}) |
|
239 |
assert widget.has_error() |
|
237 | 240 | |
238 | 241 |
def test_date_widget(): |
239 | 242 |
widget = DateWidget('test') |
wcs/qommon/form.py | ||
---|---|---|
709 | 709 |
elif get_cfg('emails', {}).get('check_domain_with_dns', True): |
710 | 710 |
# testing for domain existence |
711 | 711 |
domain = self.value.split('@')[-1] |
712 |
if [x for x in domain.split('.') if not x]: |
|
713 |
# empty parts in domain, ex: @example..net, or |
|
714 |
# @.example.net |
|
715 |
self.error = _('invalid address domain') |
|
716 |
return |
|
712 | 717 |
if not type(domain) is unicode: |
713 | 718 |
domain = unicode(domain, 'utf-8', 'ignore') |
714 | 719 |
domain = domain.encode('idna') |
715 |
- |