fix pep8, fix argparse

This commit is contained in:
Fabian Weisshaar 2017-12-28 18:55:44 +01:00 committed by Fabian Weisshaar
parent d50c225eab
commit fe1c697631
3 changed files with 55 additions and 52 deletions

View File

@ -20,7 +20,6 @@ from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six import text_type
from . import dnstools
RESULT_MSG_LEN = 255
@ -64,6 +63,7 @@ def host_blacklist_validator(value):
from collections import namedtuple
UpdateAlgorithm = namedtuple("update_algorithm", "bitlength bind_name")
UPDATE_ALGORITHM_DEFAULT = 'HMAC_SHA512'
@ -128,7 +128,8 @@ class Domain(models.Model):
last_update = models.DateTimeField(_("last update"), auto_now=True)
created = models.DateTimeField(_("created at"), auto_now_add=True)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='domains', verbose_name=_("created by"), on_delete=models.CASCADE)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='domains', verbose_name=_("created by"),
on_delete=models.CASCADE)
def __str__(self):
return self.name
@ -249,7 +250,8 @@ class Host(models.Model):
last_update = models.DateTimeField(_("last update"), auto_now=True)
created = models.DateTimeField(_("created at"), auto_now_add=True)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='hosts', verbose_name=_("created by"), on_delete=models.CASCADE)
created_by = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='hosts', verbose_name=_("created by"),
on_delete=models.CASCADE)
def __str__(self):
return u"%s.%s" % (self.name, self.domain.name)
@ -349,6 +351,7 @@ def pre_delete_host(sender, **kwargs):
# e.g. PeerBadSignature if host is protected by a key we do not have
pass
pre_delete.connect(pre_delete_host, sender=Host)
@ -364,6 +367,7 @@ def post_save_host(sender, **kwargs):
# e.g. PeerBadSignature if host is protected by a key we do not have
pass
post_save.connect(post_save_host, sender=Host)

View File

@ -12,7 +12,6 @@ from django.utils.translation import ugettext_lazy as _
from nsupdate.main.models import Host
from nsupdate.utils.mail import translate_for_user, send_mail_to_user
ABUSE_MSG = _("""\
Your host: %(fqdn)s (comment: %(comment)s)
@ -90,8 +89,8 @@ class Command(BaseCommand):
action='store',
dest='flag_abuse',
default=None,
type='int',
help='if client faults > N then set abuse flag and reset client faults')
type=int,
help='if client faults N then set abuse flag and reset client faults')
parser.add_argument('--notify-user',
action='store_true',
dest='notify_user',

View File

@ -21,7 +21,7 @@ all_files = 1
[upload_sphinx]
upload-dir = docs/_build/html
[pytest]
[tool:pytest]
DJANGO_SETTINGS_MODULE = nsupdate.settings.dev
pep8maxlinelength = 120
norecursedirs = .git