#!/usr/bin/env python
# -*- coding: utf-8 -*-

"""Sample development configuration file.

This file includes settings that are suited for hacking Pootle. For further
customizations, you can find the defaults in the ``*.conf`` files.

In order for this configuration changes to take effect, bear in mind that you
need to change the extension of this file from ``.conf.sample`` to ``.conf``.
"""

#
# Base
#

# Site title
POOTLE_TITLE = 'Pootle Development Server'

POOTLE_INSTANCE_ID = 'development'

# Some dummy secret key fine for dev
SECRET_KEY = '__P00TL3d3vS3CR3T__'

# General Django debugging settings

# Enable Django debug mode
# https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True

# Whether to debug template rendering
# https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG

# A list of strings representing the host/domain names that this Pootle server
# can serve. This is a Django's security measure. More details at
# https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
ALLOWED_HOSTS = [
    '127.0.0.1',
    'localhost',
    #'${your_server}',
]


#
# Backends
#

# Database backend settings
DATABASES = {
    'default': {
        # Although has issues with locking, SQLite is handy for development
        'ENGINE': 'transaction_hooks.backends.sqlite3',
        # Database name or path to database file if using sqlite3.
        'NAME': working_path('dbs/pootle.db'),
        # Not used with sqlite3.
        'USER': '',
        # Not used with sqlite3.
        'PASSWORD': '',
        # Set to empty string for localhost. Not used with sqlite3.
        'HOST': '',
        # Set to empty string for default. Not used with sqlite3.
        'PORT': '',
        # See https://docs.djangoproject.com/en/1.6/topics/db/transactions/
        # required for Django 1.6 + sqlite
        'ATOMIC_REQUESTS': True,
    }
}


#
# Cache Backend settings

# For more information, check
# http://docs.djangoproject.com/en/dev/topics/cache/#setting-up-the-cache
# and http://niwibe.github.io/django-redis/
#CACHES = {
#    'default': {
#        'BACKEND': 'django_redis.cache.RedisCache',
#        'LOCATION': 'redis://127.0.0.1:6379/1',
#        'TIMEOUT': 60,
#    },
#    'redis': {
#        'BACKEND': 'django_redis.cache.RedisCache',
#        'LOCATION': 'redis://127.0.0.1:6379/2',
#        'TIMEOUT': None,
#    },
#    'stats': {
#        'BACKEND': 'django_redis.cache.RedisCache',
#        'LOCATION': 'redis://127.0.0.1:6379/3',
#        'TIMEOUT': None,
#    },
#    'exports': {
#        'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
#        'LOCATION': working_path('exports/'),
#        'TIMEOUT': 259200,  # 3 days.
#    },
#}


#
# Site
#

# Mail server settings
#
# By using the 'console' email backend, any emails sent while in development
# mode will be output to stdout.
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

# Alternatively, you can run a local dummy SMTP server with
#   python -m smtpd -n -c DebuggingServer localhost:1025
# and use the following settings:
#EMAIL_HOST = 'localhost'
#EMAIL_PORT = 1025


#
# Applications
#

#
# webassets
#
# Enable debugging assets.
#
# When this is set, the templates will generate one script/link tag per each
# JavaScript/CSS file instead of putting them in bundles.
# Further details:
#   http://elsdoerfer.name/docs/webassets/django/settings.html
ASSETS_DEBUG = True

# Controls whether bundles should be automatically built and rebuilt. If set to
# ``False`` you'll need to manually generate the bundles with ``manage.py
# assets build``.
ASSETS_AUTO_BUILD = True


#
# Django extensions
#
INSTALLED_APPS += ['django_extensions']


#
# Django debug toolbar
#
# Check its README for further configuration options:
# https://github.com/django-debug-toolbar/django-debug-toolbar/blob/master/README.rst
INSTALLED_APPS += ['debug_toolbar']

MIDDLEWARE_CLASSES += [
  'debug_toolbar.middleware.DebugToolbarMiddleware',
]

DEBUG_TOOLBAR_CONFIG = {
    # Toolbar options
    'SHOW_COLLAPSED': True,
    # Panel options
    'INTERCEPT_REDIRECTS': False,
}


#
# Translation
#

# The directory where the translation files are kept
POOTLE_TRANSLATION_DIRECTORY = working_path('translations')

# Two-tuple defining the markup filter to apply in certain textareas.
#
# - Accepted values for the first element are 'textile', 'markdown',
#   'restructuredtext' and None.
# - The second element should be a dictionary of keyword arguments that will be
#   passed to the markup function.
#
# IMPORTANT: If you want to use one of these markup filters you must install on
# your own the required packages.
#
# Examples:
#    POOTLE_MARKUP_FILTER = (None, {})
#    POOTLE_MARKUP_FILTER = ('markdown', {'safe_mode': 'escape'})
#    POOTLE_MARKUP_FILTER = ('restructuredtext', {
#                                'settings_overrides': {
#                                    'report_level': 'quiet',
#                                }
#                            })
POOTLE_MARKUP_FILTER = (None, {})

# Suggestions through Machine Translation services (service name, API key).
POOTLE_MT_BACKENDS = [
#        ('APERTIUM', ''),
#        ('GOOGLE_TRANSLATE', ''),
#        ('YANDEX_TRANSLATE', ''),
]

# URL for the amaGama TM server.
AMAGAMA_URL = 'https://amagama-live.translatehouse.org/api/v1/'

# Silence the DEBUG check on dev servers
SILENCED_SYSTEM_CHECKS = [
    'pootle.W004', # python-levenstein not installed
    'pootle.W005', # DEBUG = True
    'pootle.W010', # DEFAULT_FROM_EMAIL has default setting
    'pootle.W011', # POOTLE_CONTACT_EMAIL has default setting
]
