Update management commands.

see #1024
This commit is contained in:
Antoine Nguyen
2017-02-14 16:04:48 +01:00
parent 3297b88d4f
commit ec3db91b50
5 changed files with 33 additions and 37 deletions
@@ -1,7 +1,6 @@
"""A management command to apply mailbox operations."""
import logging
from optparse import make_option
import os
from django.core.management.base import BaseCommand
@@ -25,17 +24,17 @@ class Command(BaseCommand):
help = "Handles rename and delete operations on mailboxes"
option_list = BaseCommand.option_list + (
make_option(
"--pidfile", default="/tmp/handle_mailbox_operations.pid",
help="Path to the file that will contain the PID of this process"
),
)
def __init__(self, *args, **kwargs):
super(Command, self).__init__(*args, **kwargs)
self.logger = logging.getLogger("modoboa.admin")
def add_arguments(self, parser):
"""Add extra arguments to command line."""
parser.add_argument(
"--pidfile", default="/tmp/handle_mailbox_operations.pid",
help="Path to the file that will contain the PID of this process"
)
def rename_mailbox(self, operation):
if not os.path.exists(operation.argument):
return
+2 -2
View File
@@ -190,7 +190,7 @@ Domains.prototype = {
create_dom_admin_changed: function(e) {
var $target = $(e.target);
this.change_inputs_state(($target.val() === "yes") ? false : true);
this.change_inputs_state(($target.val() === "True") ? false : true);
},
/**
@@ -215,7 +215,7 @@ Domains.prototype = {
$("input[name=create_dom_admin]").click(
$.proxy(this.create_dom_admin_changed, this));
this.change_inputs_state(
$("input[name=create_dom_admin]:checked").val() === "yes" ? false : true
$("input[name=create_dom_admin]:checked").val() === "True" ? false : true
);
this.optionsform_prefill();
},
+1 -1
View File
@@ -22,7 +22,7 @@ def enabled_applications():
result = [("user", _("User profile"))]
for extension in exts_pool.list_all():
if not extension["topredirection_url"]:
if "topredirection_url" not in extension:
continue
result.append((extension["name"], extension["label"]))
return sorted(result, key=lambda e: e[0])
+12 -12
View File
@@ -1,7 +1,7 @@
"""Extension management."""
from django.conf import settings
from django.conf.urls import include
from django.conf.urls import include, url
class ModoExtension(object):
@@ -75,18 +75,18 @@ class ExtensionsPool(object):
if extinstance is None:
return None
result = None
try:
baseurl = (
extinstance.url if extinstance.url is not None
else name
)
result = (
r'^%s/' % (baseurl),
include("{0}.urls".format(name), namespace=name)
)
except ImportError:
#try:
baseurl = (
extinstance.url if extinstance.url is not None
else name
)
result = (
url(r'^%s/' % (baseurl),
include("{0}.urls".format(name), namespace=name))
)
#except ImportError:
# No urls for this extension
pass
# pass
extinstance.load()
return result
+11 -14
View File
@@ -1,7 +1,7 @@
# coding: utf-8
import datetime
from optparse import make_option
import logging
from django.core.management.base import BaseCommand
from django.utils import timezone
@@ -12,19 +12,17 @@ from ... import parameters
class Command(BaseCommand):
args = ''
help = 'Log table cleanup'
args = ""
help = "Log table cleanup"
option_list = BaseCommand.option_list + (
make_option('--debug',
action='store_true',
default=False,
help='Activate debug output'),
make_option('--verbose',
action='store_true',
default=False,
help='Display informational messages')
)
def add_arguments(self, parser):
"""Add extra arguments to command line."""
parser.add_argument(
"--debug", action="store_true", default=False,
help="Activate debug output")
parser.add_argument(
"--verbose", action="store_true", default=False,
help="Display informational messages")
def __vprint(self, msg):
if not self.verbose:
@@ -33,7 +31,6 @@ class Command(BaseCommand):
def handle(self, *args, **options):
if options["debug"]:
import logging
l = logging.getLogger("django.db.backends")
l.setLevel(logging.DEBUG)
l.addHandler(logging.StreamHandler())