Hi guys, I didn't like the messages buit-in contrib/auth application. That's
becouse of two points:

- It don't give the ability to send messages to anonymous users (I saw that
it is one of the planned features for 1.1);
- There's no way to distinguish the messages. For example: I like my success
messages displayed differently from my fail messages, and it isn't possible.

So I decided to write a new messages app and it works very well, the only
problem is the django.core.context_processors.auth. It simply hits the
database in every request and I don't want this since I am not using these
messages. So I changed the context processor to take a
variable(AUTH_USE_MESSAGES) from settings and call or not the function that
reads the messages from database.

I read the docs about contributing to django and there is a part saying that
if the patch is non trivial, what I think it is becouse there's a dozen of
ways to achieve this, you have to discuss it first in this list. So I am
doing this.

Another idea I had is to write three diferent context processors, one to
read the user, one for the messages and another for the perms. It is just
another idea. I am attaching the patch so you can see it.

--------

Vinícius Mendes
Engenheiro de Computação
Meio Código - A peça que faltava para o seu código!
URL http://www.meiocodigo.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Index: django/core/context_processors.py
===================================================================
--- django/core/context_processors.py	(revisão 9814)
+++ django/core/context_processors.py	(cópia de trabalho)
@@ -24,7 +24,7 @@
         user = AnonymousUser()
     return {
         'user': user,
-        'messages': user.get_and_delete_messages(),
+        'messages': user.get_and_delete_messages() if getattr(settings, 'AUTH_USE_MESSAGES', True) else [],
         'perms': PermWrapper(user),
     }
 

Reply via email to