Browse files

guard against no get_absolute_url

git-svn-id: https://django-notification.googlecode.com/svn/trunk@48 590c3fc9-4838-0410-bb95-17a0c9b37ca9
  • Loading branch information...
1 parent 506ec60 commit 44c0436f77f20ab9d3fbc09f8f7c0f10e8438cc1 @jtauber jtauber committed May 29, 2008
Showing with 4 additions and 1 deletion.
  1. +4 −1 notification/models.py
View
5 notification/models.py
@@ -214,7 +214,10 @@ def decoder(ref):
def message_to_html(message):
def decoder(ref):
obj = decode_object(ref)
- return u"""<a href="%s">%s</a>""" % (obj.get_absolute_url(), unicode(obj))
+ if hasattr(obj, "get_absolute_url"): # don't fail silenty if get_absolute_url hasn't been defined
+ return u"""<a href="%s">%s</a>""" % (obj.get_absolute_url(), unicode(obj))
+ else:
+ return unicode(obj)
return decode_message(message, decoder)

0 comments on commit 44c0436

Please sign in to comment.