diff options
author | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-02-08 19:13:04 -0500 |
---|---|---|
committer | Evgeny Fadeev <evgeny.fadeev@gmail.com> | 2010-02-08 19:13:04 -0500 |
commit | bdf1cc4f9dd3f0ac06ba1af3c7d35c72cc358297 (patch) | |
tree | 61f7902b47844c05a309b7d4827897b162d39e8a /session_messages/context_processors.py | |
parent | 3e7c42f81352ad73a1395ed0601f2d4fdf9b5359 (diff) | |
download | askbot-bdf1cc4f9dd3f0ac06ba1af3c7d35c72cc358297.tar.gz askbot-bdf1cc4f9dd3f0ac06ba1af3c7d35c72cc358297.tar.bz2 askbot-bdf1cc4f9dd3f0ac06ba1af3c7d35c72cc358297.zip |
fixed a little bug that i have planted into fbconnect before, removed unused files fixed email signup form validation
Diffstat (limited to 'session_messages/context_processors.py')
-rw-r--r-- | session_messages/context_processors.py | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/session_messages/context_processors.py b/session_messages/context_processors.py deleted file mode 100644 index df9840fd..00000000 --- a/session_messages/context_processors.py +++ /dev/null @@ -1,48 +0,0 @@ -""" -Context processor for lightweight session messages. - -Time-stamp: <2008-07-19 23:16:19 carljm context_processors.py> - -""" -from django.utils.encoding import StrAndUnicode - -from session_messages import get_and_delete_messages - -def session_messages (request): - """ - Returns session messages for the current session. - - """ - return { 'session_messages': LazyMessages(request) } - -class LazyMessages (StrAndUnicode): - """ - Lazy message container, so messages aren't actually retrieved from - session and deleted until the template asks for them. - - """ - def __init__(self, request): - self.request = request - - def __iter__(self): - return iter(self.messages) - - def __len__(self): - return len(self.messages) - - def __nonzero__(self): - return bool(self.messages) - - def __unicode__(self): - return unicode(self.messages) - - def __getitem__(self, *args, **kwargs): - return self.messages.__getitem__(*args, **kwargs) - - def _get_messages(self): - if hasattr(self, '_messages'): - return self._messages - self._messages = get_and_delete_messages(self.request) - return self._messages - messages = property(_get_messages) - |