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

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

#
# Pootle FS temporary working directory.
# Do NEVER touch anything on this directory.
# This directory can potentially get very large, so you need to place it
# somewhere with plenty of free space.
#

POOTLE_FS_WORKING_PATH = working_path(os.path.join('.pootle_fs', 'tmp'))


# 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', 'html' and None (deprecated).
# - The second element should be a dictionary of keyword arguments that will be
#   passed to the markup function.
#
# Examples:
#    POOTLE_MARKUP_FILTER = ('html', {})
#    POOTLE_MARKUP_FILTER = ('markdown', {})
#    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
LOGIN_REDIRECT_URL = "/"

# Custom allauth forms
ACCOUNT_FORMS = {
  'login': 'pootle.apps.accounts.forms.SignInForm',
}

# 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

# True to always remember user session. False to not remember. None to ask user.
ACCOUNT_SESSION_REMEMBER = True

# Whether user sign up is enabled
POOTLE_SIGNUP_ENABLED = True


#
# django-statici18n
#

# Needed to integrate with `staticfiles` and ensure files generated by
# `compilejsi18n` are under our desired path. For more details, read
# http://django-statici18n.readthedocs.io/en/latest/faq.html#using-a-placeholder-directory
STATICI18N_ROOT = working_path('static')

# Directory where generated files will be written to. Customized to avoid name
# clashing with `static/js`.
STATICI18N_OUTPUT_DIR = 'translations'


#
# Reports
#

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


#
# Scoring
#

POOTLE_SCORES = {
    'suggestion_add': 0,
    'suggestion_accept': .1,
    'suggestion_reject': .1,
    'comment_updated': .1,
    'target_updated': .3,
    'state_translated': .6,
    'state_fuzzy': .1,
    'state_unfuzzy': .1,
}
