diff --git a/dyndns.py b/dyndns.py index bd2bcd486..5d5257815 100644 --- a/dyndns.py +++ b/dyndns.py @@ -52,7 +52,7 @@ def dyndns_subscribe(subscribe_host="dyndns.yunohost.org", domain=None, key=None try: if requests.get('http://%s/test/%s' % (subscribe_host, domain)).status_code != 200: raise MoulinetteError(errno.EEXIST, m18n.n('dyndns_unavailable')) - except ConnectionError: + except requests.ConnectionError: raise MoulinetteError(errno.ENETUNREACH, m18n.n('no_internet_connection')) if key is None: diff --git a/tools.py b/tools.py index 2b13c7141..ed92bd9de 100644 --- a/tools.py +++ b/tools.py @@ -191,8 +191,7 @@ def tools_maindomain(auth, old_domain=None, new_domain=None, dyndns=False): raise MoulinetteError(errno.EPERM, m18n.n('maindomain_change_failed')) - if dyndns: dyndns_subscribe(domain=new_domain) - elif len(new_domain.split('.')) >= 3: + if dyndns and len(new_domain.split('.')) >= 3: try: r = requests.get('http://dyndns.yunohost.org/domains') except ConnectionError: