# -*- coding: utf-8 -*-

"""Configuration settings for applications used by Pootle."""

#
# Pootle
#

# Custom template context
# The key-values of this context are available in the templates as
# {{ custom.<key> }}
POOTLE_CUSTOM_TEMPLATE_CONTEXT = {}


# 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, {})

# Set this to True to enable spam prevention through captcha, only
# useful for public Pootle instances.
POOTLE_CAPTCHA_ENABLED = True

# Legal Page Agreements
#
# List of paths prefixes where no checks for legal document agreements
# will be enforced
POOTLE_LEGALPAGE_NOCHECK_PREFIXES = (
    '/about',
    '/accounts',
    '/admin',
    '/contact',
    '/jsi18n',
    '/pages',
    '/xhr',
)

# Pootle META users
#
# List of special 'API users'
POOTLE_META_USERS = ()

#
# webassets
#

# Whether to debug assets or not. Set to False in production environments
# for better performance, but make sure 'cssmin' is installed.
#
# Valid options are True, False, and "merge".
# You can set more configuration options for webassets if needed.
# Read its documentation for further details:
#   http://elsdoerfer.name/docs/webassets/django/settings.html
ASSETS_DEBUG = False

# Controls whether bundles should be automatically built, and rebuilt, when
# required (if set to True), or whether they must be built manually be the
# user, for example via a management command.
#
# This is a good setting to have enabled during debugging, and can be very
# convenient for low-traffic sites in production as well. However, there is a
# cost in checking whether the source files have changed, so if you care about
# performance, or if your build process takes very long, then you may want to
# disable this.
ASSETS_AUTO_BUILD = False


#
# Allauth
#

# Determines whether or not the user is automatically logged out by a mere GET
# request.
ACCOUNT_LOGOUT_ON_GET = True

# The URL the user is redirected to on login
# https://docs.djangoproject.com/en/1.6/ref/settings/#login-redirect-url
LOGIN_REDIRECT_URL = "/"

# The allauth account adapters
ACCOUNT_ADAPTER = "pootle.apps.accounts.adapter.PootleAccountAdapter"
SOCIALACCOUNT_ADAPTER = 'accounts.social_adapter.PootleSocialAccountAdapter'

# Determines the e-mail verification method during signup: "mandatory",
# "optional", or "none".
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
SOCIALACCOUNT_EMAIL_VERIFICATION = 'optional'

# Number of days users will have to activate their accounts after registering
ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 10

# Whether an email is required on sign up. Must be true if email verification
# is mandatory
ACCOUNT_EMAIL_REQUIRED = True

# Confirm email on GET instead of POST. This is less secure, but one less step
# for users
ACCOUNT_CONFIRM_EMAIL_ON_GET = True

# Automatically sign users in upon email confirmation
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True

# Automatically sign users in upon password reset completion
ACCOUNT_LOGIN_ON_PASSWORD_RESET = True

# Whether user sign up is enabled
POOTLE_SIGNUP_ENABLED = True


#
# Reports
#

# Path to function (string) which provides data to mark user's activity
# chart with events
POOTLE_REPORTS_MARK_FUNC = ''


#
# Scoring
#

POOTLE_SCORE_COEFFICIENTS = {
    'EDIT': 5.0/7,
    'REVIEW': 2.0/7,
    'SUGGEST': 0.2,
    'ANALYZE': 0.1,
}
