Opened 19 years ago

Last modified 18 years ago

#283 closed defect

templatetags/log.py breaks on AnonymousUser — at Initial Version

Reported by: garthk@… Owned by: Adrian Holovaty
Component: Core (Other) Version:
Severity: normal Keywords: templatetags log anonymous
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Try logging in if you're already the anonymous user. Ouch! Trivial fix:

{{{C:\dev\django-svn\trunk>svn diff
Index: django/templatetags/log.py
===================================================================
--- django/templatetags/log.py (revision 416)
+++ django/templatetags/log.py (working copy)
@@ -10,7 +10,10 @@

def render(self, context):

if self.user is not None and not self.user.isdigit():

  • self.user = context[self.user].id

+ try:
+ self.user = context[self.user].id
+ except AttributeError: # AnonymousUser doesn't have it
+ pass

context[self.varname] = log.get_list(user_idexact=self.user, limit=self.limit, select_related=True)
return }}}

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top