1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-06-27 07:28:42 +00:00
seahub/base/context_processors.py

34 lines
915 B
Python
Raw Normal View History

"""
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
from settings import SEAFILE_VERSION
from settings import SEAHUB_TITLE
def base(request):
"""
Add seahub base configure to the context.
"""
2012-08-31 09:28:50 +00:00
try:
org = request.user.org
except AttributeError:
org = None
try:
base_template = request.base_template
except AttributeError:
base_template = None
return {
'seafile_version': SEAFILE_VERSION,
'seahub_title': SEAHUB_TITLE,
2012-08-01 14:34:35 +00:00
'cloud_mode': request.cloud_mode,
2012-08-31 09:28:50 +00:00
'org': org,
'base_template': base_template,
# 'account_type': settings.ACCOUNT_TYPE,
}
2012-07-26 09:08:31 +00:00