# 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 hashlib
from django.core.cache import cache
from goscale import conf
        full_module_name.decorated_function_name (for example 'goscale.utils.get_language_from_path)
        NOTE: This is done since a decorated function call always return the 
        do_cache function from the decorator, but never itself
        - *func_args: original arguments of the decorated function
        NOTE: strings as args/kwargs might be unicode and instead of passing
        'string' to the function u'string' need to be passed to
        - **func_kwargs: keyword arguments of the decorated function
    """
    if not cache_key:
        key = hashlib.sha1('%s.%s.%s' % (alternative_cache_key, func_args, func_kwargs)).hexdigest() #alternative_cache_key + str(func_args) + str(func_kwargs)
    elif isinstance(cache_key, (str, unicode)):
        key = hashlib.sha1(cache_key % locals()).hexdigest()
    elif callable(cache_key):
        key = hashlib.sha1(cache_key(*func_args, **func_kwargs)).hexdigest()
    return key

def get_cached_item(cache_key, alternative_cache_key, *func_args, **func_kwargs):
    """Not a decorator, but a helper function to retrieve the cached
    item for a key created via get_cache_key.
    Args:
        - cache_key: if there was a specific cache key used to cache the
        function, it should be provided here. If not this should be None
        - func: the function which was cache
        - *func_args: arguments of the function
        - **func_kwargs: keyword arguments of this function
    """
    key = get_cache_key(cache_key, func, *func_args, **func_kwargs)
    return cache.get(key)

@optional_arguments

# 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/decorators.py
import hashlib
from django.core.cache import cache
from goscale import conf

        full_module_name.decorated_function_name (for example 'goscale.utils.get_language_from_path)
        NOTE: This is done since a decorated function call always return the 
        do_cache function from the decorator, but never itself
        - *func_args: original arguments of the decorated function
        NOTE: strings as args/kwargs might be unicode and instead of passing
        'string' to the function u'string' need to be passed to
        - **func_kwargs: keyword arguments of the decorated function
    """
    if not cache_key:
        key = hashlib.sha1('%s.%s.%s' % (alternative_cache_key, func_args, func_kwargs)).hexdigest() #alternative_cache_key + str(func_args) + str(func_kwargs)
    elif isinstance(cache_key, (str, unicode)):
        key = hashlib.sha1(cache_key % locals()).hexdigest()
    elif callable(cache_key):
        key = hashlib.sha1(cache_key(*func_args, **func_kwargs)).hexdigest()
    return key

def get_cached_item(cache_key, alternative_cache_key, *func_args, **func_kwargs):
    """Not a decorator, but a helper function to retrieve the cached
    item for a key created via get_cache_key.
    Args:
        - cache_key: if there was a specific cache key used to cache the
        function, it should be provided here. If not this should be None
        - func: the function which was cache
        - *func_args: arguments of the function
        - **func_kwargs: keyword arguments of this function
    """
    key = get_cache_key(cache_key, func, *func_args, **func_kwargs)
    return cache.get(key)

@optional_arguments

def cache_user_page(func, duration=conf.GOSCALE_CACHE_DURATION):