autopep8 applied

master
Dmytro Makovey 7 years ago
parent b05e924f3b
commit d50ba01892

@ -18,6 +18,7 @@ def admin(localpart, domain_name, password):
db.session.add(user)
db.session.commit()
@manager.command
def user(localpart, domain_name, password, hash_scheme=app.config['PASSWORD_SCHEME']):
""" Create a user
@ -35,6 +36,7 @@ def user(localpart, domain_name, password, hash_scheme=app.config['PASSWORD_SCHE
db.session.add(user)
db.session.commit()
@manager.option('-n', '--domain_name', dest='domain_name')
@manager.option('-u', '--max_users', dest='max_users')
@manager.option('-a', '--max_aliases', dest='max_aliases')
@ -46,6 +48,7 @@ def domain(domain_name, max_users=0, max_aliases=0, max_quota_bytes=0):
db.session.add(domain)
db.session.commit()
@manager.command
def user_import(localpart, domain_name, password_hash, hash_scheme=app.config['PASSWORD_SCHEME']):
""" Import a user along with password hash. Available hashes:
@ -67,10 +70,12 @@ def user_import(localpart, domain_name, password_hash, hash_scheme=app.config['P
db.session.add(user)
db.session.commit()
@manager.command
def config_update(verbose=False, delete_objects=False):
"""sync configuration with data from YAML-formatted stdin"""
import yaml, sys
import yaml
import sys
new_config = yaml.load(sys.stdin)
# print new_config
domains = new_config.get('domains', [])
@ -204,6 +209,7 @@ def config_update(verbose=False, delete_objects=False):
db.session.delete(domain)
db.session.commit()
@manager.command
def user_delete(email):
"""delete user"""
@ -212,6 +218,7 @@ def user_delete(email):
db.session.delete(user)
db.session.commit()
@manager.command
def alias_delete(email):
"""delete alias"""
@ -220,6 +227,7 @@ def alias_delete(email):
db.session.delete(alias)
db.session.commit()
@manager.command
def alias(localpart, domain_name, destination):
""" Create an alias
@ -238,6 +246,8 @@ def alias(localpart, domain_name, destination):
db.session.commit()
# Set limits to a domain
@manager.command
def setlimits(domain_name, max_users, max_aliases, max_quota_bytes):
domain = models.Domain.query.get(domain_name)
@ -249,6 +259,8 @@ def setlimits(domain_name, max_users, max_aliases, max_quota_bytes):
db.session.commit()
# Make the user manager of a domain
@manager.command
def setmanager(domain_name, user_name='manager'):
domain = models.Domain.query.get(domain_name)

Loading…
Cancel
Save