django-orchestra/orchestra/apps/mailboxes/settings.py

92 lines
2.4 KiB
Python
Raw Normal View History

2014-10-27 13:29:02 +00:00
import os
2014-10-09 17:04:12 +00:00
import textwrap
2014-08-22 15:31:44 +00:00
from django.conf import settings
2014-10-09 17:04:12 +00:00
from django.utils.translation import ugettext_lazy as _
2014-08-22 15:31:44 +00:00
from orchestra.settings import BASE_DOMAIN
2014-08-22 15:31:44 +00:00
MAILBOXES_DOMAIN_MODEL = getattr(settings, 'MAILBOXES_DOMAIN_MODEL',
'domains.Domain'
)
2014-08-22 15:31:44 +00:00
MAILBOXES_HOME = getattr(settings, 'MAILBOXES_HOME',
'/home/%(name)s/'
)
2014-08-22 15:31:44 +00:00
2014-10-06 14:57:02 +00:00
2014-10-27 13:29:02 +00:00
MAILBOXES_SIEVE_PATH = getattr(settings, 'MAILBOXES_SIEVE_PATH',
os.path.join(MAILBOXES_HOME, 'Maildir/sieve/orchestra.sieve')
)
2014-10-27 13:29:02 +00:00
MAILBOXES_SIEVETEST_PATH = getattr(settings, 'MAILBOXES_SIEVETEST_PATH',
'/dev/shm'
)
2014-10-06 14:57:02 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_SIEVETEST_BIN_PATH = getattr(settings, 'MAILBOXES_SIEVETEST_BIN_PATH',
'%(orchestra_root)s/bin/sieve-test'
)
2014-08-22 15:31:44 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_VIRTUAL_MAILBOX_MAPS_PATH = getattr(settings, 'MAILBOXES_VIRTUAL_MAILBOX_MAPS_PATH',
'/etc/postfix/virtual_mailboxes'
)
2014-08-22 15:31:44 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_VIRTUAL_ALIAS_MAPS_PATH = getattr(settings, 'MAILBOXES_VIRTUAL_ALIAS_MAPS_PATH',
'/etc/postfix/virtual_aliases'
)
2014-08-22 15:31:44 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_VIRTUAL_ALIAS_DOMAINS_PATH = getattr(settings, 'MAILBOXES_VIRTUAL_ALIAS_DOMAINS_PATH',
'/etc/postfix/virtual_domains'
)
2014-08-22 15:31:44 +00:00
2014-10-06 14:57:02 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_VIRTUAL_MAILBOX_DEFAULT_DOMAIN = getattr(settings, 'MAILBOXES_VIRTUAL_MAILBOX_DEFAULT_DOMAIN',
BASE_DOMAIN
)
2014-10-06 14:57:02 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_PASSWD_PATH = getattr(settings, 'MAILBOXES_PASSWD_PATH',
'/etc/dovecot/passwd'
)
2014-10-09 17:04:12 +00:00
2014-10-17 10:04:47 +00:00
MAILBOXES_MAILBOX_FILTERINGS = getattr(settings, 'MAILBOXES_MAILBOX_FILTERINGS', {
2014-10-09 17:04:12 +00:00
# value: (verbose_name, filter)
'DISABLE': (_("Disable"), ''),
'REJECT': (_("Reject spam"), textwrap.dedent("""
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "5" {
discard;
stop;
}""")),
'REDIRECT': (_("Archive spam"), textwrap.dedent("""
require ["fileinto","regex","envelope","vacation","reject","relational","comparator-i;ascii-numeric"];
if header :value "ge" :comparator "i;ascii-numeric" "X-Spam-Score" "5" {
fileinto "Spam";
stop;
}""")),
'CUSTOM': (_("Custom filtering"), lambda mailbox: mailbox.custom_filtering),
})
2014-11-27 19:17:26 +00:00
MAILBOXES_MAILBOX_DEFAULT_FILTERING = getattr(settings, 'MAILBOXES_MAILBOX_DEFAULT_FILTERING',
'REDIRECT'
)
2014-11-17 14:17:33 +00:00
MAILBOXES_MAILDIRSIZE_PATH = getattr(settings, 'MAILBOXES_MAILDIRSIZE_PATH',
'%(home)s/Maildir/maildirsize'
)
2014-11-27 19:17:26 +00:00
MAILBOXES_LOCAL_ADDRESS_DOMAIN = getattr(settings, 'MAILBOXES_LOCAL_ADDRESS_DOMAIN',
BASE_DOMAIN
)