Commit 05753259330e6b24c90728261fde79524c73681a
1 parent
ff63d6ca
Exists in
master
and in
39 other branches
Allow to configure path and exclude lists in settings
Showing
2 changed files
with
10 additions
and
5 deletions
Show diff stats
colab/settings.py
| ... | ... | @@ -243,6 +243,11 @@ MESSAGE_TAGS = { |
| 243 | 243 | messages.ERROR: 'alert-danger', |
| 244 | 244 | } |
| 245 | 245 | |
| 246 | +# Super Archives | |
| 247 | +SUPER_ARCHIVES_PATH = '/var/lib/mailman/archives/public' | |
| 248 | +SUPER_ARCHIVES_EXCLUDE = [] | |
| 249 | +SUPER_ARCHIVES_LOCK_FILE = '/var/lock/colab/import_emails.lock' | |
| 250 | + | |
| 246 | 251 | # Feedzilla (planet) |
| 247 | 252 | from feedzilla.settings import * # noqa (flake8 ignore) |
| 248 | 253 | FEEDZILLA_PAGE_SIZE = 5 | ... | ... |
colab/super_archives/management/commands/import_emails.py
| ... | ... | @@ -10,6 +10,7 @@ import mailbox |
| 10 | 10 | import logging |
| 11 | 11 | from optparse import make_option |
| 12 | 12 | |
| 13 | +from django.conf import settings | |
| 13 | 14 | from django.db import transaction |
| 14 | 15 | from django.template.defaultfilters import slugify |
| 15 | 16 | from django.core.management.base import BaseCommand, CommandError |
| ... | ... | @@ -27,13 +28,12 @@ class Command(BaseCommand, object): |
| 27 | 28 | |
| 28 | 29 | help = __doc__ |
| 29 | 30 | |
| 30 | - default_archives_path = '/var/lib/mailman/archives/private' | |
| 31 | 31 | RE_SUBJECT_CLEAN = re.compile('((re|res|fw|fwd|en|enc):)|\[.*?\]', |
| 32 | 32 | re.IGNORECASE) |
| 33 | 33 | THREAD_CACHE = {} |
| 34 | 34 | EMAIL_ADDR_CACHE = {} |
| 35 | 35 | |
| 36 | - lock_file = '/var/lock/colab/import_emails.lock' | |
| 36 | + lock_file = settings.SUPER_ARCHIVES_LOCK_FILE | |
| 37 | 37 | |
| 38 | 38 | # A new command line option to get the dump file to parse. |
| 39 | 39 | option_list = BaseCommand.option_list + ( |
| ... | ... | @@ -41,8 +41,8 @@ class Command(BaseCommand, object): |
| 41 | 41 | '--archives_path', |
| 42 | 42 | dest='archives_path', |
| 43 | 43 | help=('Path of email archives to be imported. ' |
| 44 | - '(default: {})').format(default_archives_path), | |
| 45 | - default=default_archives_path), | |
| 44 | + '(default: {})').format(settings.SUPER_ARCHIVES_PATH), | |
| 45 | + default=settings.SUPER_ARCHIVES_PATH), | |
| 46 | 46 | |
| 47 | 47 | make_option( |
| 48 | 48 | '--exclude-list', |
| ... | ... | @@ -50,7 +50,7 @@ class Command(BaseCommand, object): |
| 50 | 50 | help=("Mailing list that won't be imported. It can be used many" |
| 51 | 51 | "times for more than one list."), |
| 52 | 52 | action='append', |
| 53 | - default=None), | |
| 53 | + default=settings.SUPER_ARCHIVES_EXCLUDE), | |
| 54 | 54 | |
| 55 | 55 | make_option( |
| 56 | 56 | '--all', | ... | ... |