mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
@@ -6,11 +6,10 @@ from django.core.management.base import BaseCommand
|
||||
|
||||
from modoboa.core import load_core_settings
|
||||
from modoboa.core.extensions import exts_pool
|
||||
from modoboa.core.management.commands import CloseConnectionMixin
|
||||
from ...models import Domain
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
help = 'Export domains and domain aliases to a csv'
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
|
||||
@@ -7,11 +7,10 @@ from django.core.management.base import BaseCommand
|
||||
from modoboa.core import load_core_settings
|
||||
from modoboa.core.models import User
|
||||
from modoboa.core.extensions import exts_pool
|
||||
from modoboa.core.management.commands import CloseConnectionMixin
|
||||
from ...models import Alias
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
help = 'Export identities (mailbox and aliases) to a csv'
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
|
||||
@@ -5,7 +5,6 @@ import os
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
from modoboa.core.management.commands import CloseConnectionMixin
|
||||
from modoboa.lib import parameters
|
||||
from modoboa.lib.sysutils import exec_cmd
|
||||
from modoboa.lib.exceptions import InternalError
|
||||
@@ -18,7 +17,7 @@ class OperationError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
help = 'Handles rename and delete operations on mailboxes'
|
||||
|
||||
option_list = BaseCommand.option_list + (
|
||||
|
||||
@@ -5,12 +5,11 @@ from django.core.management.base import BaseCommand
|
||||
|
||||
from modoboa.core import load_core_settings
|
||||
from modoboa.core.extensions import exts_pool
|
||||
from modoboa.core.management.commands import CloseConnectionMixin
|
||||
|
||||
from ._import import import_csv
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
args = 'csvfile'
|
||||
help = 'Import domains and domain aliases from a csv file'
|
||||
|
||||
|
||||
@@ -4,12 +4,11 @@ from django.core.management.base import BaseCommand
|
||||
|
||||
from modoboa.core import load_core_settings
|
||||
from modoboa.core.extensions import exts_pool
|
||||
from modoboa.core.management.commands import CloseConnectionMixin
|
||||
|
||||
from ._import import import_csv
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
args = 'csvfile'
|
||||
help = 'Import identities from a csv file'
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
"""
|
||||
Extra classes for management commands.
|
||||
"""
|
||||
|
||||
from django.db import connection
|
||||
|
||||
|
||||
class CloseConnectionMixin(object):
|
||||
|
||||
"""
|
||||
A simple mixin used to close all database connections after
|
||||
command execution.
|
||||
"""
|
||||
|
||||
def execute(self, *args, **options):
|
||||
"""Execute will call handle so we can close the connection here."""
|
||||
super(CloseConnectionMixin, self).execute(*args, **options)
|
||||
connection.close()
|
||||
|
||||
@@ -10,10 +10,8 @@ from modoboa.core import load_core_settings
|
||||
from modoboa.core.models import Log
|
||||
from modoboa.lib import parameters
|
||||
|
||||
from . import CloseConnectionMixin
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
args = ''
|
||||
help = 'Log table cleanup'
|
||||
|
||||
|
||||
@@ -18,10 +18,9 @@ from modoboa.lib import models as lib_models
|
||||
from modoboa.lib.permissions import add_permissions_to_group
|
||||
from modoboa.limits.app_settings import load_limits_settings
|
||||
import modoboa.relaydomains.models as relay_models
|
||||
from . import CloseConnectionMixin
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
|
||||
"""Command defintion."""
|
||||
|
||||
|
||||
@@ -9,10 +9,8 @@ from django.core.management.base import BaseCommand, CommandError
|
||||
|
||||
from django.contrib.sites.models import Site
|
||||
|
||||
from . import CloseConnectionMixin
|
||||
|
||||
|
||||
class Command(BaseCommand, CloseConnectionMixin):
|
||||
class Command(BaseCommand):
|
||||
|
||||
"""Management command to set the default site."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user