Author: [EMAIL PROTECTED]
Date: Thu Oct 30 03:09:11 2008
New Revision: 81

Modified:
    trunk/messages/templatetags/inbox.py

Log:
catch exception if templatetag is used for anonymous users.

Modified: trunk/messages/templatetags/inbox.py
==============================================================================
--- trunk/messages/templatetags/inbox.py        (original)
+++ trunk/messages/templatetags/inbox.py        Thu Oct 30 03:09:11 2008
@@ -2,8 +2,11 @@

  class InboxOutput(Node):
      def render(self, context):
-        user = context['user']
-        count = user.received_messages.filter(read_at__isnull=True,  
recipient_deleted_at__isnull=True).count()
+        try:
+            user = context['user']
+            count = user.received_messages.filter(read_at__isnull=True,  
recipient_deleted_at__isnull=True).count()
+        except (KeyError, AttributeError):
+            count = ''
          return "%s" % (count)

  def do_print_inbox_count(parser, token):

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pinax-updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/pinax-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to