made the latest changes pep8 compatible

This commit is contained in:
Daniel Steglich 2015-03-03 21:42:54 +01:00
parent 81ad2019b1
commit df0d1304b7

View File

@ -71,19 +71,22 @@ class TrimmedCharField(forms.CharField):
class ConfigureForm(forms.Form): class ConfigureForm(forms.Form):
"""Form to configure the dynamic DNS client""" """Form to configure the dynamic DNS client"""
enabled = forms.BooleanField(label=_('Enable Dynamic DNS'), enabled = forms.BooleanField(label=_('Enable Dynamic DNS'),
required=False,widget=forms.CheckboxInput required=False, widget=forms.CheckboxInput
(attrs={'onclick': 'mod_form();'})) (attrs={'onclick': 'mod_form();'}))
dynamicdns_service = forms.ChoiceField(label=_('Service type'), service_type = forms.ChoiceField(label=_('Service type'),
help_text=_('Please choose a update protocol according to your provider.\ help_text=_('Please choose a update\
We recommend the GnudIP protocol. If your provider does not \ protocol according to your \
support the GnudIP protocol or your provider is not listed \ provider. If your provider does not\
you may use the update URL of your provider.'), support the GnudIP protocol or your\
provider is not listed you may use\
the update URL of your provider.'),
choices=(('1', 'GnuDIP'), choices=(('1', 'GnuDIP'),
('2', 'noip.com'), ('2', 'noip.com'),
('3', 'selfhost.bz'), ('3', 'selfhost.bz'),
('4', 'other Update URL')), ('4', 'other Update URL')),
widget=forms.Select(attrs={'onChange':'dropdown()'})) widget=forms.Select(attrs={'onChange':
'dropdown()'}))
dynamicdns_server = TrimmedCharField( dynamicdns_server = TrimmedCharField(
label=_('GnudIP Server Address'), label=_('GnudIP Server Address'),
@ -93,21 +96,22 @@ class ConfigureForm(forms.Form):
validators.RegexValidator(r'^[\w-]{1,63}(\.[\w-]{1,63})*$', validators.RegexValidator(r'^[\w-]{1,63}(\.[\w-]{1,63})*$',
_('Invalid server name'))]) _('Invalid server name'))])
dynamicdns_update_url = TrimmedCharField( dynamicdns_update_url = TrimmedCharField(label=_('Update URL'),
label=_('Update URL'),
required=False, required=False,
help_text=_('The Variables $User, $Pass, $IP, $Domain may be used \ help_text=_('The Variables $User\
within this URL.</br> Example URL: </br> \ , $Pass, $IP, $Domain\
https://some.tld/up.php?us=$User&pw=$Pass&ip=$IP&dom=$Domain')) may be used'))
disable_SSL_cert_check = forms.BooleanField( disable_SSL_cert_check = forms.BooleanField(label=_('accept all SSL \
label=_('accept all SSL certificates'), certificates'),
help_text=_('use this option if your provider uses\ help_text=_('use this option \
self signed certificates'), if your provider \
uses self signed\
certificates'),
required=False) required=False)
use_http_basic_auth = forms.BooleanField( use_http_basic_auth = forms.BooleanField(label=_('use HTTP basic \
label=_('use HTTP basic authentication'), authentication'),
required=False) required=False)
dynamicdns_domain = TrimmedCharField( dynamicdns_domain = TrimmedCharField(
@ -270,11 +274,11 @@ def get_status():
status['use_http_basic_auth'] = False status['use_http_basic_auth'] = False
if not status['dynamicdns_server'] and not status['dynamicdns_update_url']: if not status['dynamicdns_server'] and not status['dynamicdns_update_url']:
status['dynamicdns_service'] = '1' status['service_type'] = '1'
elif not status['dynamicdns_server'] and status['dynamicdns_update_url']: elif not status['dynamicdns_server'] and status['dynamicdns_update_url']:
status['dynamicdns_service'] = '4' status['service_type'] = '4'
else: else:
status['dynamicdns_service'] = '1' status['service_type'] = '1'
return status return status
@ -309,8 +313,8 @@ def _apply_changes(request, old_status, new_status):
old_status['enabled'] != \ old_status['enabled'] != \
new_status['enabled']: new_status['enabled']:
disable_ssl_check="disabled" disable_ssl_check = "disabled"
use_http_basic_auth="disabled" use_http_basic_auth = "disabled"
if new_status['disable_SSL_cert_check']: if new_status['disable_SSL_cert_check']:
disable_ssl_check = "enabled" disable_ssl_check = "enabled"