mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-11-27 11:24:28 +01:00
Manually load extensions inside management commands.
This commit is contained in:
@@ -16,10 +16,14 @@ from modoboa.extensions.admin.models import Domain
|
|||||||
from modoboa.extensions.amavis.models import (
|
from modoboa.extensions.amavis.models import (
|
||||||
Msgrcpt
|
Msgrcpt
|
||||||
)
|
)
|
||||||
from modoboa.extensions.amavis.sql_connector import get_connector
|
from ...modo_extension import Amavis
|
||||||
|
from ...sql_connector import get_connector
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand, CloseConnectionMixin):
|
class Command(BaseCommand, CloseConnectionMixin):
|
||||||
|
|
||||||
|
"""A management command to notify admins about pending release requests."""
|
||||||
|
|
||||||
help = 'Amavis notification tool'
|
help = 'Amavis notification tool'
|
||||||
|
|
||||||
sender = None
|
sender = None
|
||||||
@@ -40,6 +44,7 @@ class Command(BaseCommand, CloseConnectionMixin):
|
|||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
if options["baseurl"] is None:
|
if options["baseurl"] is None:
|
||||||
raise CommandError("You must provide the --baseurl option")
|
raise CommandError("You must provide the --baseurl option")
|
||||||
|
Amavis.load()
|
||||||
self.options = options
|
self.options = options
|
||||||
self.notify_admins_pending_requests()
|
self.notify_admins_pending_requests()
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from modoboa.extensions.amavis.models import (
|
|||||||
Msgrcpt, Msgs, Maddr
|
Msgrcpt, Msgs, Maddr
|
||||||
)
|
)
|
||||||
from modoboa.lib import parameters
|
from modoboa.lib import parameters
|
||||||
|
from ...modo_extension import Amavis
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand, CloseConnectionMixin):
|
class Command(BaseCommand, CloseConnectionMixin):
|
||||||
@@ -34,6 +35,7 @@ class Command(BaseCommand, CloseConnectionMixin):
|
|||||||
print msg
|
print msg
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
Amavis.load()
|
||||||
if options["debug"]:
|
if options["debug"]:
|
||||||
import logging
|
import logging
|
||||||
l = logging.getLogger("django.db.backends")
|
l = logging.getLogger("django.db.backends")
|
||||||
|
|||||||
@@ -10,7 +10,8 @@ from modoboa.core.management.commands import CloseConnectionMixin
|
|||||||
from modoboa.lib import parameters
|
from modoboa.lib import parameters
|
||||||
from modoboa.lib.email_utils import split_mailbox, sendmail_simple
|
from modoboa.lib.email_utils import split_mailbox, sendmail_simple
|
||||||
from modoboa.extensions.admin.models import Mailbox
|
from modoboa.extensions.admin.models import Mailbox
|
||||||
from modoboa.extensions.postfix_autoreply.models import ARmessage, ARhistoric
|
from ...models import ARmessage, ARhistoric
|
||||||
|
from ...modo_extension import PostfixAutoreply
|
||||||
|
|
||||||
|
|
||||||
def send_autoreply(sender, mailbox, armessage):
|
def send_autoreply(sender, mailbox, armessage):
|
||||||
@@ -52,6 +53,7 @@ class Command(BaseCommand, CloseConnectionMixin):
|
|||||||
raise CommandError(
|
raise CommandError(
|
||||||
"usage: ./manage.py autoreply <sender> <recipient ...>")
|
"usage: ./manage.py autoreply <sender> <recipient ...>")
|
||||||
|
|
||||||
|
PostfixAutoreply.load()
|
||||||
sender = args[0]
|
sender = args[0]
|
||||||
for fulladdress in args[1:]:
|
for fulladdress in args[1:]:
|
||||||
address, domain = split_mailbox(fulladdress)
|
address, domain = split_mailbox(fulladdress)
|
||||||
|
|||||||
@@ -8,9 +8,10 @@ from modoboa.core.management.commands import CloseConnectionMixin
|
|||||||
from modoboa.core.models import User
|
from modoboa.core.models import User
|
||||||
from modoboa.lib import parameters
|
from modoboa.lib import parameters
|
||||||
from modoboa.extensions.admin.models import Domain
|
from modoboa.extensions.admin.models import Domain
|
||||||
from modoboa.extensions.radicale.models import (
|
from ...models import (
|
||||||
AccessRule
|
AccessRule
|
||||||
)
|
)
|
||||||
|
from ...modo_extension import Radicale
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand, CloseConnectionMixin):
|
class Command(BaseCommand, CloseConnectionMixin):
|
||||||
@@ -102,6 +103,7 @@ permission = %s
|
|||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
"""Command entry point."""
|
"""Command entry point."""
|
||||||
|
Radicale.load()
|
||||||
path = parameters.get_admin("RIGHTS_FILE_PATH", app="radicale")
|
path = parameters.get_admin("RIGHTS_FILE_PATH", app="radicale")
|
||||||
if not options["force"]:
|
if not options["force"]:
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ from modoboa.core.management.commands import CloseConnectionMixin
|
|||||||
from modoboa.extensions.admin.models import Domain
|
from modoboa.extensions.admin.models import Domain
|
||||||
from modoboa.extensions.stats.lib import date_to_timestamp
|
from modoboa.extensions.stats.lib import date_to_timestamp
|
||||||
from modoboa.lib import parameters
|
from modoboa.lib import parameters
|
||||||
|
from ...modo_extension import Stats
|
||||||
|
|
||||||
rrdstep = 60
|
rrdstep = 60
|
||||||
xpoints = 540
|
xpoints = 540
|
||||||
@@ -372,6 +373,7 @@ class Command(BaseCommand, CloseConnectionMixin):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
|
Stats.load()
|
||||||
if options["logfile"] is None:
|
if options["logfile"] is None:
|
||||||
options["logfile"] = parameters.get_admin("LOGFILE", app="stats")
|
options["logfile"] = parameters.get_admin("LOGFILE", app="stats")
|
||||||
p = LogParser(options, parameters.get_admin("RRD_ROOTDIR", app="stats"))
|
p = LogParser(options, parameters.get_admin("RRD_ROOTDIR", app="stats"))
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ This module provides support to retrieve statistics from postfix log :
|
|||||||
sent, received, bounced, rejected
|
sent, received, bounced, rejected
|
||||||
|
|
||||||
"""
|
"""
|
||||||
import sys
|
|
||||||
|
|
||||||
from django.utils.translation import ugettext_lazy
|
from django.utils.translation import ugettext_lazy
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user