reorder imports: stdlib, other libs, django, nsupdate stuff (views, etc.)

This commit is contained in:
Thomas Waldmann 2013-10-03 19:26:39 +02:00
parent f4f953141f
commit 1924888b37
12 changed files with 33 additions and 21 deletions

View File

@ -1,7 +1,8 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.contrib.auth.views import password_change
from accounts.views import UserProfileView from accounts.views import UserProfileView
from django.contrib.auth.views import password_change
urlpatterns = patterns( urlpatterns = patterns(
'', '',

View File

@ -1,8 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os
import logging import logging
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
import dns.inet
from django.http import HttpResponse from django.http import HttpResponse
from django.conf import settings from django.conf import settings
from django.contrib.auth.hashers import check_password from django.contrib.auth.hashers import check_password
@ -10,9 +14,6 @@ from django.contrib.auth.decorators import login_required
from django.contrib.sessions.backends.db import SessionStore from django.contrib.sessions.backends.db import SessionStore
from main.models import Host from main.models import Host
import dns.inet
import os
from main.dnstools import update, SameIpError from main.dnstools import update, SameIpError

View File

@ -4,12 +4,14 @@ Tests for dnstools module.
import pytest import pytest
from ..dnstools import add, delete, update, query_ns, parse_name, update_ns, SameIpError
from django.conf import settings
BASEDOMAIN = settings.BASEDOMAIN
from dns.resolver import NXDOMAIN from dns.resolver import NXDOMAIN
from django.conf import settings
from ..dnstools import add, delete, update, query_ns, parse_name, update_ns, SameIpError
BASEDOMAIN = settings.BASEDOMAIN
class TestIntelligentUpdater(object): class TestIntelligentUpdater(object):
def test_double_update(self): def test_double_update(self):

View File

@ -1,6 +1,7 @@
from main.models import Host, Domain, BlacklistedDomain
from django.contrib import admin from django.contrib import admin
from main.models import Host, Domain, BlacklistedDomain
admin.site.register(BlacklistedDomain) admin.site.register(BlacklistedDomain)
admin.site.register(Domain) admin.site.register(Domain)
admin.site.register(Host) admin.site.register(Host)

View File

@ -4,8 +4,6 @@ Misc. DNS related code: query, dynamic update, etc.
Usually, higher level code wants to call the add/update/delete functions. Usually, higher level code wants to call the add/update/delete functions.
""" """
from django.conf import settings
import dns.inet import dns.inet
import dns.name import dns.name
import dns.resolver import dns.resolver
@ -14,6 +12,8 @@ import dns.update
import dns.tsig import dns.tsig
import dns.tsigkeyring import dns.tsigkeyring
from django.conf import settings
class SameIpError(ValueError): class SameIpError(ValueError):
""" """

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from django import forms from django import forms
from main.models import Host from main.models import Host

View File

@ -1,3 +1,8 @@
import re
from datetime import datetime
import dns.resolver
from django.db import models from django.db import models
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@ -5,11 +10,8 @@ from django.core.validators import RegexValidator
from django.conf import settings from django.conf import settings
from django.db.models.signals import post_delete from django.db.models.signals import post_delete
from django.contrib.auth.hashers import make_password from django.contrib.auth.hashers import make_password
from main import dnstools
import dns.resolver
from datetime import datetime
import re from main import dnstools
class BlacklistedDomain(models.Model): class BlacklistedDomain(models.Model):

View File

@ -1,11 +1,13 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from django.views.generic import TemplateView from django.views.generic import TemplateView
from main.views import ( from main.views import (
HomeView, OverviewView, HostView, DeleteHostView, AboutView, HelpView, GenerateSecretView, HomeView, OverviewView, HostView, DeleteHostView, AboutView, HelpView, GenerateSecretView,
RobotsTxtView, ) RobotsTxtView, )
from api.views import ( from api.views import (
MyIpView, DetectIpView, NicUpdateView, AuthorizedNicUpdateView) MyIpView, DetectIpView, NicUpdateView, AuthorizedNicUpdateView)
urlpatterns = patterns( urlpatterns = patterns(
'', '',
url(r'^$', HomeView.as_view(), name="home"), url(r'^$', HomeView.as_view(), name="home"),

View File

@ -1,4 +1,7 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import dns.inet
from django.views.generic import TemplateView, CreateView from django.views.generic import TemplateView, CreateView
from django.views.generic.edit import UpdateView, DeleteView from django.views.generic.edit import UpdateView, DeleteView
from django.http import HttpResponse, HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
@ -7,7 +10,7 @@ from django.contrib import messages
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.exceptions import PermissionDenied from django.core.exceptions import PermissionDenied
import dns.inet
import dnstools import dnstools
from main.forms import CreateHostForm, EditHostForm from main.forms import CreateHostForm, EditHostForm

View File

@ -2,9 +2,8 @@
import os import os
import sys import sys
if __name__ == "__main__": if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nsupdate.settings") os.environ.setdefault("DJANGO_SETTINGS_MODULE", "nsupdate.settings")
from django.core.management import execute_from_command_line from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv) execute_from_command_line(sys.argv)

View File

@ -2,9 +2,9 @@
Django settings for nsupdate project Django settings for nsupdate project
""" """
import django.conf.global_settings as DEFAULT_SETTINGS
import dns.tsig
import os import os
import dns.tsig
import django.conf.global_settings as DEFAULT_SETTINGS
DEBUG = True DEBUG = True
TEMPLATE_DEBUG = DEBUG TEMPLATE_DEBUG = DEBUG

View File

@ -1,6 +1,6 @@
from django.conf.urls import patterns, include, url from django.conf.urls import patterns, include, url
from django.contrib import admin from django.contrib import admin
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns( urlpatterns = patterns(