2011-03-08 22:32:27 +03:00
|
|
|
import atexit
|
|
|
|
import tempfile
|
|
|
|
|
2012-09-06 02:25:36 +04:00
|
|
|
from django.utils.functional import lazy
|
2011-03-08 22:32:27 +03:00
|
|
|
|
2013-07-02 21:32:16 +04:00
|
|
|
|
2011-03-08 22:32:27 +03:00
|
|
|
_tmpdirs = set()
|
|
|
|
|
|
|
|
|
|
|
|
def _cleanup():
|
|
|
|
try:
|
|
|
|
import sys
|
|
|
|
import shutil
|
|
|
|
except ImportError:
|
|
|
|
return
|
|
|
|
tmp = None
|
|
|
|
try:
|
|
|
|
for tmp in _tmpdirs:
|
|
|
|
shutil.rmtree(tmp)
|
|
|
|
except Exception, exc:
|
|
|
|
sys.stderr.write("\n** shutil.rmtree(%r): %s\n" % (tmp, exc))
|
|
|
|
|
|
|
|
atexit.register(_cleanup)
|
|
|
|
|
|
|
|
|
|
|
|
def _polite_tmpdir():
|
|
|
|
tmp = tempfile.mkdtemp()
|
|
|
|
_tmpdirs.add(tmp)
|
|
|
|
return tmp
|
|
|
|
|
|
|
|
# See settings.py for documentation:
|
2012-05-02 21:30:28 +04:00
|
|
|
IN_TEST_SUITE = True
|
2011-03-08 22:32:27 +03:00
|
|
|
NETAPP_STORAGE = _polite_tmpdir()
|
|
|
|
ADDONS_PATH = _polite_tmpdir()
|
|
|
|
GUARDED_ADDONS_PATH = _polite_tmpdir()
|
2012-09-20 03:57:17 +04:00
|
|
|
SIGNED_APPS_PATH = _polite_tmpdir()
|
|
|
|
SIGNED_APPS_REVIEWER_PATH = _polite_tmpdir()
|
2011-03-08 22:32:27 +03:00
|
|
|
UPLOADS_PATH = _polite_tmpdir()
|
|
|
|
MIRROR_STAGE_PATH = _polite_tmpdir()
|
2011-04-28 04:44:38 +04:00
|
|
|
TMP_PATH = _polite_tmpdir()
|
2011-04-28 21:28:48 +04:00
|
|
|
COLLECTIONS_ICON_PATH = _polite_tmpdir()
|
2011-05-26 03:44:34 +04:00
|
|
|
PACKAGER_PATH = _polite_tmpdir()
|
2013-03-28 08:33:37 +04:00
|
|
|
REVIEWER_ATTACHMENTS_PATH = _polite_tmpdir()
|
2013-05-22 19:00:03 +04:00
|
|
|
DUMPED_APPS_PATH = _polite_tmpdir()
|
2011-06-28 21:37:12 +04:00
|
|
|
|
2011-08-23 01:24:19 +04:00
|
|
|
# We won't actually send an email.
|
|
|
|
SEND_REAL_EMAIL = True
|
|
|
|
|
2011-06-28 21:37:12 +04:00
|
|
|
# Turn off search engine indexing.
|
|
|
|
USE_ELASTIC = False
|
2011-08-03 01:16:19 +04:00
|
|
|
|
|
|
|
# Ensure all validation code runs in tests:
|
|
|
|
VALIDATE_ADDONS = True
|
2011-08-05 00:53:55 +04:00
|
|
|
|
2011-09-07 02:22:24 +04:00
|
|
|
PAYPAL_PERMISSIONS_URL = ''
|
2011-09-17 01:40:27 +04:00
|
|
|
|
2013-12-06 20:45:07 +04:00
|
|
|
ENABLE_API_ERROR_SERVICE = False
|
2013-11-28 19:44:16 +04:00
|
|
|
|
2013-10-03 02:35:22 +04:00
|
|
|
SITE_URL = 'http://testserver'
|
|
|
|
STATIC_URL = SITE_URL + '/'
|
2011-09-17 02:49:15 +04:00
|
|
|
MOBILE_SITE_URL = ''
|
2012-02-01 21:18:24 +04:00
|
|
|
MEDIA_URL = '/media/'
|
|
|
|
# Reset these URLs to the defaults so your settings_local doesn't clobber them:
|
|
|
|
ADDON_ICONS_DEFAULT_URL = MEDIA_URL + '/img/addon-icons'
|
|
|
|
ADDON_ICON_BASE_URL = MEDIA_URL + 'img/icons/'
|
2013-10-03 02:35:22 +04:00
|
|
|
ADDON_ICON_URL = (STATIC_URL +
|
|
|
|
'img/uploads/addon_icons/%s/%s-%s.png?modified=%s')
|
|
|
|
PREVIEW_THUMBNAIL_URL = (STATIC_URL +
|
|
|
|
'img/uploads/previews/thumbs/%s/%d.png?modified=%d')
|
|
|
|
PREVIEW_FULL_URL = (STATIC_URL +
|
|
|
|
'img/uploads/previews/full/%s/%d.%s?modified=%d')
|
|
|
|
USERPICS_URL = STATIC_URL + 'img/uploads/userpics/%s/%s/%s.png?modified=%d'
|
2011-09-17 01:52:04 +04:00
|
|
|
|
2012-10-23 01:21:18 +04:00
|
|
|
CACHES = {
|
|
|
|
'default': {
|
2013-10-02 01:56:32 +04:00
|
|
|
'BACKEND': 'caching.backends.locmem.LocMemCache',
|
2012-10-23 01:21:18 +04:00
|
|
|
}
|
|
|
|
}
|
2011-12-31 02:07:41 +04:00
|
|
|
|
2013-10-02 01:56:32 +04:00
|
|
|
# COUNT() caching can't be invalidated, it just expires after x seconds. This
|
|
|
|
# is just too annoying for tests, so disable it.
|
|
|
|
CACHE_COUNT_TIMEOUT = None
|
|
|
|
|
2011-12-31 02:07:41 +04:00
|
|
|
# No more failures!
|
|
|
|
APP_PREVIEW = False
|
2012-02-01 21:16:38 +04:00
|
|
|
|
|
|
|
# Overrides whatever storage you might have put in local settings.
|
|
|
|
DEFAULT_FILE_STORAGE = 'amo.utils.LocalFileStorage'
|
2012-04-06 00:44:55 +04:00
|
|
|
|
2012-04-09 20:40:56 +04:00
|
|
|
VIDEO_LIBRARIES = ['lib.video.dummy']
|
2012-05-31 20:06:40 +04:00
|
|
|
|
2012-09-28 04:36:03 +04:00
|
|
|
ALLOW_SELF_REVIEWS = True
|
|
|
|
|
2012-05-31 20:06:40 +04:00
|
|
|
# Make sure debug toolbar output is disabled so it doesn't interfere with any
|
|
|
|
# html tests.
|
|
|
|
|
2012-09-04 19:55:31 +04:00
|
|
|
|
2012-05-31 20:06:40 +04:00
|
|
|
DEBUG_TOOLBAR_CONFIG = {
|
|
|
|
'INTERCEPT_REDIRECTS': False,
|
2013-01-23 03:02:18 +04:00
|
|
|
'SHOW_TOOLBAR_CALLBACK': lambda r: False,
|
2012-05-31 20:06:40 +04:00
|
|
|
'HIDE_DJANGO_SQL': True,
|
|
|
|
'TAG': 'div',
|
2012-09-04 19:55:31 +04:00
|
|
|
'ENABLE_STACKTRACES': False,
|
2012-05-31 20:06:40 +04:00
|
|
|
}
|
2012-06-23 02:57:43 +04:00
|
|
|
|
|
|
|
MOZMARKET_VENDOR_EXCLUDE = []
|
2012-09-06 02:25:36 +04:00
|
|
|
|
|
|
|
# These are the default languages. If you want a constrainted set for your
|
|
|
|
# tests, you should add those in the tests.
|
2012-09-04 19:55:31 +04:00
|
|
|
|
|
|
|
|
2012-09-06 02:25:36 +04:00
|
|
|
def lazy_langs(languages):
|
|
|
|
from product_details import product_details
|
|
|
|
if not product_details.languages:
|
|
|
|
return {}
|
|
|
|
return dict([(i.lower(), product_details.languages[i]['native'])
|
|
|
|
for i in languages])
|
|
|
|
|
|
|
|
AMO_LANGUAGES = (
|
|
|
|
'af', 'ar', 'bg', 'ca', 'cs', 'da', 'de', 'el', 'en-US', 'es', 'eu', 'fa',
|
|
|
|
'fi', 'fr', 'ga-IE', 'he', 'hu', 'id', 'it', 'ja', 'ko', 'mn', 'nl', 'pl',
|
|
|
|
'pt-BR', 'pt-PT', 'ro', 'ru', 'sk', 'sl', 'sq', 'sv-SE', 'uk', 'vi',
|
|
|
|
'zh-CN', 'zh-TW',
|
|
|
|
)
|
|
|
|
LANGUAGES = lazy(lazy_langs, dict)(AMO_LANGUAGES)
|
|
|
|
LANGUAGE_URL_MAP = dict([(i.lower(), i) for i in AMO_LANGUAGES])
|
2012-10-19 00:18:00 +04:00
|
|
|
TASK_USER_ID = '4043307'
|
2012-11-01 19:32:08 +04:00
|
|
|
|
|
|
|
PASSWORD_HASHERS = (
|
2014-02-14 20:52:12 +04:00
|
|
|
'users.models.SHA512PasswordHasher',
|
2012-11-01 19:32:08 +04:00
|
|
|
'django.contrib.auth.hashers.MD5PasswordHasher',
|
|
|
|
)
|
2012-11-20 08:17:09 +04:00
|
|
|
|
|
|
|
SQL_RESET_SEQUENCES = False
|
2013-07-02 21:32:16 +04:00
|
|
|
|
2013-09-07 09:03:53 +04:00
|
|
|
ES_DEFAULT_NUM_REPLICAS = 0
|
|
|
|
ES_DEFAULT_NUM_SHARDS = 3
|
2013-09-10 20:54:52 +04:00
|
|
|
|
2014-02-19 03:45:58 +04:00
|
|
|
# Ensure that exceptions aren't re-raised.
|
|
|
|
DEBUG_PROPAGATE_EXCEPTIONS = False
|