summaryrefslogtreecommitdiffstats
path: root/context.py
diff options
context:
space:
mode:
authorBruno Sarlo <bruno@bruno-laptop.(none)>2009-08-08 21:44:10 -0300
committerBruno Sarlo <bruno@bruno-laptop.(none)>2009-08-08 21:44:10 -0300
commit0161159eb5b84d11908c16c6c86f93e1a8ac3c18 (patch)
tree871b0856af5e2dd5b816ee419857a38f80cd6b87 /context.py
parent0b80e6ba3fa528df2fc64a1a2e3a9f58dec39ec5 (diff)
parent46da3fdbe80ea1f6b9278d2671757d5fdb8abcfb (diff)
downloadaskbot-0161159eb5b84d11908c16c6c86f93e1a8ac3c18.tar.gz
askbot-0161159eb5b84d11908c16c6c86f93e1a8ac3c18.tar.bz2
askbot-0161159eb5b84d11908c16c6c86f93e1a8ac3c18.zip
Merge branch 'master' of git://github.com/evgenyfadeev/CNPROG
* Merge of Spanish translation, still missing some texts. * Custom colors for preguntalo project Conflicts: locale/es/LC_MESSAGES/django.mo locale/es/LC_MESSAGES/django.po templates/content/style/style.css
Diffstat (limited to 'context.py')
-rw-r--r--context.py35
1 files changed, 33 insertions, 2 deletions
diff --git a/context.py b/context.py
index f420b154..c068332c 100644
--- a/context.py
+++ b/context.py
@@ -1,9 +1,40 @@
from django.conf import settings
def application_settings(context):
- return {
+ my_settings = {
'APP_TITLE' : settings.APP_TITLE,
'APP_URL' : settings.APP_URL,
'APP_KEYWORDS' : settings.APP_KEYWORDS,
'APP_DESCRIPTION' : settings.APP_DESCRIPTION,
- 'APP_INTRO' : settings.APP_INTRO
+ 'APP_INTRO' : settings.APP_INTRO,
+ 'EMAIL_VALIDATION': settings.EMAIL_VALIDATION,
+ 'LANGUAGE_CODE': settings.LANGUAGE_CODE,
+ 'GOOGLE_SITEMAP_CODE':settings.GOOGLE_SITEMAP_CODE,
+ 'GOOGLE_ANALYTICS_KEY':settings.GOOGLE_ANALYTICS_KEY,
}
+ return {'settings':my_settings}
+
+def auth_processor(request):
+ """
+ Returns context variables required by apps that use Django's authentication
+ system.
+
+ If there is no 'user' attribute in the request, uses AnonymousUser (from
+ django.contrib.auth).
+ """
+ if hasattr(request, 'user'):
+ user = request.user
+ if user.is_authenticated():
+ messages = user.message_set.all()
+ else:
+ messages = None
+ else:
+ from django.contrib.auth.models import AnonymousUser
+ user = AnonymousUser()
+ messages = None
+
+ from django.core.context_processors import PermWrapper
+ return {
+ 'user': user,
+ 'messages': messages,
+ 'perms': PermWrapper(user),
+ }