Add a project specific configuration file, and create a template context processor to tell if tasks claim are enabled or not.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Thu, 20 Jan 2011 17:47:41 +0530
changeset 502 1e5df997eb01
parent 501 b84d6a1d4603
child 503 a3e85fd764c7
Add a project specific configuration file, and create a template context processor to tell if tasks claim are enabled or not.
pytask/configuration.py
pytask/settings.py
pytask/taskapp/context_processors.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/configuration.py	Thu Jan 20 17:47:41 2011 +0530
@@ -0,0 +1,10 @@
+"""A configuration settings file for PyTask project.
+"""
+
+
+__authors__ = [
+    '"Madhusudan.C.S" <madhusudancs@fossee.in>',
+    ]
+
+
+TASK_CLAIM_ENABLED = False
\ No newline at end of file
--- a/pytask/settings.py	Thu Jan 20 17:46:49 2011 +0530
+++ b/pytask/settings.py	Thu Jan 20 17:47:41 2011 +0530
@@ -59,6 +59,15 @@
 # Make this unique, and don't share it with anybody.
 SECRET_KEY = '^ww=xk&idt)=03kqg*fz8x%=dqbhh1kd2z=f%$m@r9_+9b=&x='
 
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.contrib.auth.context_processors.auth',
+    'django.core.context_processors.debug',
+    'django.core.context_processors.i18n',
+    'django.core.context_processors.media',
+    'django.contrib.messages.context_processors.messages',
+    'pytask.taskapp.context_processors.configuration',
+    )
+
 # List of callables that know how to import templates from various sources.
 TEMPLATE_LOADERS = (
     'django.template.loaders.filesystem.Loader',
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/pytask/taskapp/context_processors.py	Thu Jan 20 17:47:41 2011 +0530
@@ -0,0 +1,20 @@
+"""Module containing the context processors for taskapp.
+"""
+
+
+__authors__ = [
+    '"Madhusudan.C.S" <madhusudancs@fossee.in>',
+    ]
+
+
+from pytask import configuration as config_settings
+
+
+def configuration(request):
+    """Context processor that puts all the necessary configuration
+    related variables to every RequestContext'ed template.
+    """
+
+    return {
+      'TASK_CLAIM_ENABLED': config_settings.TASK_CLAIM_ENABLED,
+      }