pep8/flake8 applied

master
Dmytro Makovey 7 years ago
parent d50ba01892
commit 18ba724505

@ -20,7 +20,8 @@ def admin(localpart, domain_name, password):
@manager.command @manager.command
def user(localpart, domain_name, password, hash_scheme=app.config['PASSWORD_SCHEME']): def user(localpart, domain_name, password,
hash_scheme=app.config['PASSWORD_SCHEME']):
""" Create a user """ Create a user
""" """
domain = models.Domain.query.get(domain_name) domain = models.Domain.query.get(domain_name)
@ -50,7 +51,8 @@ def domain(domain_name, max_users=0, max_aliases=0, max_quota_bytes=0):
@manager.command @manager.command
def user_import(localpart, domain_name, password_hash, hash_scheme=app.config['PASSWORD_SCHEME']): def user_import(localpart, domain_name, password_hash,
hash_scheme=app.config['PASSWORD_SCHEME']):
""" Import a user along with password hash. Available hashes: """ Import a user along with password hash. Available hashes:
'SHA512-CRYPT' 'SHA512-CRYPT'
'SHA256-CRYPT' 'SHA256-CRYPT'
@ -106,15 +108,15 @@ def config_update(verbose=False, delete_objects=False):
users = new_config.get('users', []) users = new_config.get('users', [])
tracked_users = set() tracked_users = set()
user_optional_params = ('comment', 'quota_bytes', 'global_admin', user_optional_params = ('comment', 'quota_bytes', 'global_admin',
'enable_imap', 'enable_pop', 'forward_enabled', 'forward_destination', 'enable_imap', 'enable_pop', 'forward_enabled',
'reply_enabled', 'reply_subject', 'reply_body', 'displayed_name', 'spam_enabled', 'forward_destination', 'reply_enabled',
'email', 'spam_threshold') 'reply_subject', 'reply_body', 'displayed_name',
'spam_enabled', 'email', 'spam_threshold')
for user_config in users: for user_config in users:
if verbose: if verbose:
print(str(user_config)) print(str(user_config))
localpart = user_config['localpart'] localpart = user_config['localpart']
domain_name = user_config['domain'] domain_name = user_config['domain']
global_admin = user_config.get('global_admin', False)
password_hash = user_config.get('password_hash', None) password_hash = user_config.get('password_hash', None)
hash_scheme = user_config.get('hash_scheme', None) hash_scheme = user_config.get('hash_scheme', None)
domain = models.Domain.query.get(domain_name) domain = models.Domain.query.get(domain_name)
@ -185,7 +187,7 @@ def config_update(verbose=False, delete_objects=False):
user_name = manager_config['user'] user_name = manager_config['user']
domain = models.Domain.query.get(domain_name) domain = models.Domain.query.get(domain_name)
manageruser = models.User.query.get(user_name + '@' + domain_name) manageruser = models.User.query.get(user_name + '@' + domain_name)
if not manageruser in domain.managers: if manageruser not in domain.managers:
domain.managers.append(manageruser) domain.managers.append(manageruser)
db.session.add(domain) db.session.add(domain)

Loading…
Cancel
Save