From 48d7f68ed514b23ec6850afeda7f8d09139aba29 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sat, 27 Mar 2021 16:12:20 -0400 Subject: [PATCH] config, dynamicdns, pagekite: Remove incorrect use of str This was used before to ensure the domain name was ASCII. However, str does not convert to ASCII in Python 3. Note that in config module, which sets the system domain name, the domain is already restricted to alphanumerics, hyphen, and period. Signed-off-by: James Valleroy Reviewed-by: Veiko Aasa --- plinth/modules/config/views.py | 3 --- plinth/modules/dynamicdns/views.py | 6 +----- plinth/modules/pagekite/forms.py | 6 +----- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/plinth/modules/config/views.py b/plinth/modules/config/views.py index a88a6cde2..d39eacf9c 100644 --- a/plinth/modules/config/views.py +++ b/plinth/modules/config/views.py @@ -117,9 +117,6 @@ def set_domainname(domainname, old_domainname): """Sets machine domain name to domainname""" old_domainname = config.get_domainname() - # Domain name should be ASCII. If it's unicode, convert to ASCII. - domainname = str(domainname) - # Domain name is not case sensitive, but Let's Encrypt certificate # paths use lower-case domain name. domainname = domainname.lower() diff --git a/plinth/modules/dynamicdns/views.py b/plinth/modules/dynamicdns/views.py index da6aa7ecf..99cdf5bfa 100644 --- a/plinth/modules/dynamicdns/views.py +++ b/plinth/modules/dynamicdns/views.py @@ -129,13 +129,9 @@ def _apply_changes(request, old_status, new_status): if new_status.get('use_ipv6'): use_ipv6 = "enabled" - # Domain name should be ASCII. If it's unicode, convert to - # ASCII. - new_domain_name = str(new_status['dynamicdns_domain']) - # Domain name is not case sensitive, but Let's Encrypt # certificate paths use lower-case domain name. - new_domain_name = new_domain_name.lower() + new_domain_name = new_status['dynamicdns_domain'].lower() _run([ 'configure', diff --git a/plinth/modules/pagekite/forms.py b/plinth/modules/pagekite/forms.py index e95ca3b42..336530eed 100644 --- a/plinth/modules/pagekite/forms.py +++ b/plinth/modules/pagekite/forms.py @@ -67,12 +67,8 @@ class ConfigurationForm(forms.Form): old = _filter(self.initial) new = _filter(self.cleaned_data) - # Kite name should be ASCII. If it's unicode, convert to - # ASCII. - kite_name = str(new['kite_name']) - # Let's Encrypt certificate paths use lower-case kite name. - kite_name = kite_name.lower() + kite_name = new['kite_name'].lower() if old != new: frontend = f"{new['server_domain']}:{new['server_port']}"