Rename the context processor

This commit is contained in:
Sunil Mohan Adapa 2014-08-17 19:30:44 +05:30
parent 65cdcb1bc3
commit 418f5ff397
2 changed files with 9 additions and 5 deletions

View File

@ -15,14 +15,18 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
"""
Django context processors to provide common data to templates.
"""
import re
import cfg
def plinth_processor(request):
"""Add additional context values to RequestContext for use in templates"""
slash_indizes = [m.start() for m in re.finditer('/', request.path)]
active_menu_urls = [request.path[:index+1] for index in slash_indizes]
def common(request):
"""Add additional context values to RequestContext for use in templates."""
slash_indices = [match.start() for match in re.finditer('/', request.path)]
active_menu_urls = [request.path[:index + 1] for index in slash_indices]
return {
'cfg': cfg,
'submenu': cfg.main_menu.active_item(request),

View File

@ -126,7 +126,7 @@ def configure_django():
'django.core.context_processors.static',
'django.core.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'context_processors.plinth_processor']
'context_processors.common']
logging_configuration = {
'version': 1,