# Path: goscale/conf.py
# DEFAULT_LANGUAGE = getattr(settings, 'DEFAULT_LANGUAGE', 'en')
# GOSCALE_DEFAULT_POST_PLUGIN = getattr(settings, 'GOSCALE_DEFAULT_POST_PLUGIN', 'post.html')
# GOSCALE_UPDATE_FROM_ADMIN = getattr(settings, 'GOSCALE_UPDATE_FROM_ADMIN', False)
# CELERY_IMPORTS = getattr(settings, 'CELERY_IMPORTS', ())
# GOSCALE_POSTS_UPDATE_FREQUENCY = getattr(settings, 'GOSCALE_POSTS_UPDATE_FREQUENCY', 60*30) # 30 minutes
# GOSCALE_CACHE_DURATION = getattr(
#     settings,
#     'GOSCALE_CACHE_DURATION',
#     getattr(settings, 'CMS_CACHE_DURATIONS', {'content': 1})['content']
# )
# GOSCALE_BROWSER_CACHE_MAX_AGE = getattr(settings, 'GOSCALE_CACHE_DURATION', GOSCALE_CACHE_DURATION)
# GOSCALE_STANDARD_TZ_DELTA = getattr(settings, 'GOSCALE_STANDARD_TZ_DELTA', 0)
# GOSCALE_POST_SUMMARY_LIMIT = getattr(settings, 'GOSCALE_POST_SUMMARY_LIMIT', 300)
# GOSCALE_DEFAULT_PAGE_SIZE = getattr(settings, 'GOSCALE_DEFAULT_PAGE_SIZE', 10)
# GOSCALE_DEFAULT_BLOG = getattr(settings, 'DEFAULT_BLOG', '')
# GOSCALE_GOOGLE_ACCOUNT = getattr(settings, 'GOSCALE_GOOGLE_ACCOUNT', '')
# GOSCALE_GOOGLE_ACCOUNT_PASSWORD = getattr(settings, 'GOSCALE_GOOGLE_ACCOUNT_PASSWORD', '')
# GOSCALE_JSON_INDENT = getattr(settings, 'GOSCALE_JSON_INDENT', 4 if settings.DEBUG else 0)
# GOSCALE_DEFAULT_CONTENT_ORDER = getattr(settings, 'GOSCALE_DEFAULT_CONTENT_ORDER', '-published')
# GOSCALE_BOOTSTRAP_THEMES = getattr(settings, 'GOSCALE_BOOTSTRAP_THEMES', [
#     'default',
#     'amelia',
#     'cerulean',
#     'cosmo',
#     'cyborg',
#     'journal',
#     'readable',
#     'simplex',
#     'slate',
#     'spacelab',
#     'spruce',
#     'superhero',
#     'united',
# ])
# GOSCALE_BOOTSTRAP_THEME = getattr(settings, 'GOSCALE_BOOTSTRAP_THEME', GOSCALE_BOOTSTRAP_THEMES[0])
# GOSCALE_AJAXLINKS = getattr(settings, 'GOSCALE_AJAXLINKS', False)
# GOSCALE_AJAXLINKS_EXCEPTIONS = getattr(settings, 'GOSCALE_AJAXLINKS_EXCEPTIONS', [
#     '#',
#     '*/accounts/*',
#     '*/goscale/signup/*',
#     '*/__debug__/*',
# ])
# GOSCALE_ROOT_TEMPLATE_DIR = 'goscale'
# GOSCALE_ATOM_DATETIME_FORMAT = getattr(settings, 'GOSCALE_ATOM_DATETIME_FORMAT', '%Y-%m-%dT%H:%M:%S') #without timezone
# GOSCALE_RSS_DATETIME_FORMAT = getattr(settings, 'GOSCALE_RSS_DATETIME_FORMAT', '%a, %d %b %Y %H:%M:%S')  #without timezone
# GOSCALE_SUPPORTED_OUTPUT_FORMATS = getattr(settings, 'GOSCALE_SUPPORTED_OUTPUT_FORMATS', ['html','rss','json', 'atom'])


import simplejson
from django.conf import settings
from django.contrib.sites.models import get_current_site
from goscale import conf

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


def theme(request):
    # set  config
    site_theme = settings.THEME
    static_theme_url = '%sthemes/%s/static/' % (settings.STATIC_URL, site_theme)
    static_common_url = '%sthemes/common/static/' % settings.STATIC_URL
    config = {}
    settings_list = ['GOSCALE_BOOTSTRAP_THEMES', 'GOSCALE_BOOTSTRAP_THEME',
                     'GOSCALE_AJAXLINKS', 'GOSCALE_AJAXLINKS_EXCEPTIONS']
    for setting in settings_list:
        config[setting] = conf.__dict__.get(setting)
    theme = request.GET.get('theme')
    # build the context
    return {
        'site': get_current_site(request),
        'GOSCALE_THEME': site_theme,
        'STATIC_THEME_URL': static_theme_url,
        'STATIC_COMMON_URL': static_common_url,
        'goscale_config': config,

# Path: goscale/conf.py
# DEFAULT_LANGUAGE = getattr(settings, 'DEFAULT_LANGUAGE', 'en')
# GOSCALE_DEFAULT_POST_PLUGIN = getattr(settings, 'GOSCALE_DEFAULT_POST_PLUGIN', 'post.html')
# GOSCALE_UPDATE_FROM_ADMIN = getattr(settings, 'GOSCALE_UPDATE_FROM_ADMIN', False)
# CELERY_IMPORTS = getattr(settings, 'CELERY_IMPORTS', ())
# GOSCALE_POSTS_UPDATE_FREQUENCY = getattr(settings, 'GOSCALE_POSTS_UPDATE_FREQUENCY', 60*30) # 30 minutes
# GOSCALE_CACHE_DURATION = getattr(
#     settings,
#     'GOSCALE_CACHE_DURATION',
#     getattr(settings, 'CMS_CACHE_DURATIONS', {'content': 1})['content']
# )
# GOSCALE_BROWSER_CACHE_MAX_AGE = getattr(settings, 'GOSCALE_CACHE_DURATION', GOSCALE_CACHE_DURATION)
# GOSCALE_STANDARD_TZ_DELTA = getattr(settings, 'GOSCALE_STANDARD_TZ_DELTA', 0)
# GOSCALE_POST_SUMMARY_LIMIT = getattr(settings, 'GOSCALE_POST_SUMMARY_LIMIT', 300)
# GOSCALE_DEFAULT_PAGE_SIZE = getattr(settings, 'GOSCALE_DEFAULT_PAGE_SIZE', 10)
# GOSCALE_DEFAULT_BLOG = getattr(settings, 'DEFAULT_BLOG', '')
# GOSCALE_GOOGLE_ACCOUNT = getattr(settings, 'GOSCALE_GOOGLE_ACCOUNT', '')
# GOSCALE_GOOGLE_ACCOUNT_PASSWORD = getattr(settings, 'GOSCALE_GOOGLE_ACCOUNT_PASSWORD', '')
# GOSCALE_JSON_INDENT = getattr(settings, 'GOSCALE_JSON_INDENT', 4 if settings.DEBUG else 0)
# GOSCALE_DEFAULT_CONTENT_ORDER = getattr(settings, 'GOSCALE_DEFAULT_CONTENT_ORDER', '-published')
# GOSCALE_BOOTSTRAP_THEMES = getattr(settings, 'GOSCALE_BOOTSTRAP_THEMES', [
#     'default',
#     'amelia',
#     'cerulean',
#     'cosmo',
#     'cyborg',
#     'journal',
#     'readable',
#     'simplex',
#     'slate',
#     'spacelab',
#     'spruce',
#     'superhero',
#     'united',
# ])
# GOSCALE_BOOTSTRAP_THEME = getattr(settings, 'GOSCALE_BOOTSTRAP_THEME', GOSCALE_BOOTSTRAP_THEMES[0])
# GOSCALE_AJAXLINKS = getattr(settings, 'GOSCALE_AJAXLINKS', False)
# GOSCALE_AJAXLINKS_EXCEPTIONS = getattr(settings, 'GOSCALE_AJAXLINKS_EXCEPTIONS', [
#     '#',
#     '*/accounts/*',
#     '*/goscale/signup/*',
#     '*/__debug__/*',
# ])
# GOSCALE_ROOT_TEMPLATE_DIR = 'goscale'
# GOSCALE_ATOM_DATETIME_FORMAT = getattr(settings, 'GOSCALE_ATOM_DATETIME_FORMAT', '%Y-%m-%dT%H:%M:%S') #without timezone
# GOSCALE_RSS_DATETIME_FORMAT = getattr(settings, 'GOSCALE_RSS_DATETIME_FORMAT', '%a, %d %b %Y %H:%M:%S')  #without timezone
# GOSCALE_SUPPORTED_OUTPUT_FORMATS = getattr(settings, 'GOSCALE_SUPPORTED_OUTPUT_FORMATS', ['html','rss','json', 'atom'])


# Path: goscale/themes/context_processors.py
import simplejson
from django.conf import settings
from django.contrib.sites.models import get_current_site
from goscale import conf

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


def theme(request):
    # set  config
    site_theme = settings.THEME
    static_theme_url = '%sthemes/%s/static/' % (settings.STATIC_URL, site_theme)
    static_common_url = '%sthemes/common/static/' % settings.STATIC_URL
    config = {}
    settings_list = ['GOSCALE_BOOTSTRAP_THEMES', 'GOSCALE_BOOTSTRAP_THEME',
                     'GOSCALE_AJAXLINKS', 'GOSCALE_AJAXLINKS_EXCEPTIONS']
    for setting in settings_list:
        config[setting] = conf.__dict__.get(setting)
    theme = request.GET.get('theme')
    # build the context
    return {
        'site': get_current_site(request),
        'GOSCALE_THEME': site_theme,
        'STATIC_THEME_URL': static_theme_url,
        'STATIC_COMMON_URL': static_common_url,
        'goscale_config': config,

        'goscale_bootstrap_theme': theme if theme else conf.GOSCALE_BOOTSTRAP_THEME,
