mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-12-04 19:15:30 +00:00
LGTM fixes. Remove unused import and variables
This commit is contained in:
parent
53a7545ccc
commit
6af94df00a
@ -49,7 +49,7 @@ def create_app(config=None):
|
||||
# HSTS
|
||||
if app.config.get('HSTS_ENABLED'):
|
||||
from flask_sslify import SSLify
|
||||
_sslify = SSLify(app)
|
||||
_sslify = SSLify(app) # lgtm [py/unused-import]
|
||||
|
||||
# Load app's components
|
||||
assets.init_app(app)
|
||||
|
@ -1,7 +1,7 @@
|
||||
import base64
|
||||
import binascii
|
||||
from functools import wraps
|
||||
from flask import g, redirect, url_for, request, abort, current_app, render_template
|
||||
from flask import g, request, abort, current_app, render_template
|
||||
from flask_login import current_user
|
||||
|
||||
from .models import User, ApiKey, Setting, Domain
|
||||
|
@ -9,7 +9,6 @@ import os
|
||||
from distutils.version import StrictVersion
|
||||
from urllib.parse import urlparse
|
||||
from datetime import datetime, timedelta
|
||||
from threading import Thread
|
||||
|
||||
from .certutil import KEY_FILE, CERT_FILE
|
||||
|
||||
@ -58,12 +57,18 @@ def fetch_remote(remote_url,
|
||||
r.raise_for_status()
|
||||
except Exception as e:
|
||||
msg = "Returned status {0} and content {1}"
|
||||
raise RuntimeError('Error while fetching {0}'.format(remote_url))
|
||||
raise RuntimeError('Error while fetching {0}. {1}'.format(
|
||||
remote_url, msg))
|
||||
|
||||
return r
|
||||
|
||||
|
||||
def fetch_json(remote_url, method='GET', data=None, params=None, headers=None, timeout=None):
|
||||
def fetch_json(remote_url,
|
||||
method='GET',
|
||||
data=None,
|
||||
params=None,
|
||||
headers=None,
|
||||
timeout=None):
|
||||
r = fetch_remote(remote_url,
|
||||
method=method,
|
||||
data=data,
|
||||
@ -78,7 +83,10 @@ def fetch_json(remote_url, method='GET', data=None, params=None, headers=None, t
|
||||
if r.status_code == 204:
|
||||
return {}
|
||||
elif r.status_code == 409:
|
||||
return {'error': 'Resource already exists or conflict', 'http_code': r.status_code}
|
||||
return {
|
||||
'error': 'Resource already exists or conflict',
|
||||
'http_code': r.status_code
|
||||
}
|
||||
|
||||
try:
|
||||
assert ('json' in r.headers['content-type'])
|
||||
|
@ -20,4 +20,4 @@ from .record_entry import RecordEntry
|
||||
|
||||
def init_app(app):
|
||||
db.init_app(app)
|
||||
_migrate = Migrate(app, db)
|
||||
_migrate = Migrate(app, db) # lgtm [py/unused-import]
|
||||
|
@ -287,7 +287,8 @@ class Domain(db.Model):
|
||||
account_id = None
|
||||
# add new domain
|
||||
d = Domain()
|
||||
d.name = domain['name'].rstrip('.')
|
||||
d.name = domain['name'].rstrip(
|
||||
'.') # lgtm [py/modification-of-default-value]
|
||||
d.master = str(domain['masters'])
|
||||
d.type = domain['kind']
|
||||
d.serial = domain['serial']
|
||||
|
@ -3,7 +3,6 @@ from flask import current_app
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from ..lib import utils
|
||||
from .base import db
|
||||
from .setting import Setting
|
||||
|
||||
|
||||
|
@ -2,7 +2,6 @@ import sys
|
||||
import pytimeparse
|
||||
from ast import literal_eval
|
||||
from distutils.util import strtobool
|
||||
from distutils.version import StrictVersion
|
||||
|
||||
from .base import db
|
||||
|
||||
|
@ -1,15 +1,13 @@
|
||||
import re
|
||||
import json
|
||||
import traceback
|
||||
import datetime
|
||||
from ast import literal_eval
|
||||
from distutils.version import StrictVersion
|
||||
from flask import Blueprint, render_template, make_response, url_for, current_app, g, session, request, redirect, jsonify, abort
|
||||
from flask_login import login_user, login_required, current_user
|
||||
from flask import Blueprint, render_template, make_response, url_for, current_app, request, redirect, jsonify, abort
|
||||
from flask_login import login_required, current_user
|
||||
|
||||
from .base import login_manager
|
||||
from ..decorators import operator_role_required, admin_role_required
|
||||
from ..models.user import User, Anonymous
|
||||
from ..models.user import User
|
||||
from ..models.account import Account
|
||||
from ..models.account_user import AccountUser
|
||||
from ..models.role import Role
|
||||
|
@ -1,6 +1,6 @@
|
||||
import base64
|
||||
from flask import render_template, url_for, redirect, session, request, current_app
|
||||
from flask_login import LoginManager, login_user
|
||||
from flask_login import LoginManager
|
||||
|
||||
from ..models.user import User
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
from flask import Blueprint, render_template, make_response, url_for, current_app, request, jsonify, redirect
|
||||
from flask import Blueprint, render_template, url_for, current_app, request, jsonify, redirect
|
||||
from flask_login import login_required, current_user
|
||||
from sqlalchemy import not_, or_
|
||||
from sqlalchemy import not_
|
||||
|
||||
from ..lib.utils import customBoxes
|
||||
from ..models.user import User
|
||||
@ -33,7 +33,7 @@ def domains_custom(boxId):
|
||||
.outerjoin(Account, Domain.account_id == Account.id) \
|
||||
.outerjoin(AccountUser, Account.id == AccountUser.account_id) \
|
||||
.filter(
|
||||
db.or_(
|
||||
d(
|
||||
DomainUser.user_id == current_user.id,
|
||||
AccountUser.user_id == current_user.id
|
||||
))
|
||||
|
@ -1,14 +1,12 @@
|
||||
import re
|
||||
import json
|
||||
import traceback
|
||||
import datetime
|
||||
from distutils.version import StrictVersion
|
||||
from flask import Blueprint, render_template, make_response, url_for, current_app, g, session, request, redirect, abort, jsonify
|
||||
from flask_login import login_user, login_required, current_user
|
||||
from flask import Blueprint, render_template, make_response, url_for, current_app, request, redirect, abort, jsonify
|
||||
from flask_login import login_required, current_user
|
||||
|
||||
from .base import login_manager
|
||||
from ..decorators import can_create_domain, operator_role_required, can_access_domain, can_configure_dnssec
|
||||
from ..models.user import User, Anonymous
|
||||
from ..models.user import User
|
||||
from ..models.account import Account
|
||||
from ..models.setting import Setting
|
||||
from ..models.history import History
|
||||
|
@ -1,12 +1,10 @@
|
||||
import qrcode as qrc
|
||||
import qrcode.image.svg as qrc_svg
|
||||
from io import BytesIO
|
||||
from flask import Blueprint, request, render_template, make_response, jsonify, redirect, url_for, current_app, session, g
|
||||
from flask_login import current_user, login_user, logout_user, login_required
|
||||
from flask import Blueprint, request, render_template, make_response, jsonify, redirect, url_for, session
|
||||
from flask_login import current_user, login_required
|
||||
|
||||
from .base import login_manager
|
||||
from ..models.user import User
|
||||
from ..models.role import Role
|
||||
|
||||
user_bp = Blueprint('user',
|
||||
__name__,
|
||||
|
@ -13,7 +13,6 @@
|
||||
import sys
|
||||
import logging
|
||||
|
||||
from flask import current_app
|
||||
from powerdnsadmin import create_app
|
||||
from powerdnsadmin.models.domain import Domain
|
||||
from powerdnsadmin.models.setting import Setting
|
||||
|
Loading…
Reference in New Issue
Block a user