2012-05-03 10:52:43 +08:00
|
|
|
"""
|
|
|
|
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.
|
|
|
|
"""
|
2012-09-18 14:04:47 +08:00
|
|
|
from settings import SEAFILE_VERSION, SEAHUB_TITLE
|
|
|
|
try:
|
|
|
|
from settings import BUSINESS_MODE
|
|
|
|
except ImportError:
|
|
|
|
BUSINESS_MODE = False
|
2012-05-03 10:52:43 +08:00
|
|
|
|
2012-05-30 22:42:21 +08:00
|
|
|
def base(request):
|
2012-05-03 10:52:43 +08:00
|
|
|
"""
|
2012-05-30 22:42:21 +08:00
|
|
|
Add seahub base configure to the context.
|
2012-05-03 10:52:43 +08:00
|
|
|
|
|
|
|
"""
|
2012-08-31 17:28:50 +08:00
|
|
|
try:
|
|
|
|
org = request.user.org
|
|
|
|
except AttributeError:
|
|
|
|
org = None
|
|
|
|
try:
|
|
|
|
base_template = request.base_template
|
|
|
|
except AttributeError:
|
2012-09-01 17:46:46 +08:00
|
|
|
base_template = 'myhome_base.html'
|
2012-05-30 22:42:21 +08:00
|
|
|
return {
|
2012-08-01 17:42:28 +08:00
|
|
|
'seafile_version': SEAFILE_VERSION,
|
|
|
|
'seahub_title': SEAHUB_TITLE,
|
2012-09-17 21:38:54 +08:00
|
|
|
'business_mode': BUSINESS_MODE,
|
2012-08-01 22:34:35 +08:00
|
|
|
'cloud_mode': request.cloud_mode,
|
2012-08-31 17:28:50 +08:00
|
|
|
'org': org,
|
|
|
|
'base_template': base_template,
|
2012-05-30 22:42:21 +08:00
|
|
|
}
|
2012-07-26 17:08:31 +08:00
|
|
|
|