# HG changeset patch # User Brian Neal # Date 1346530660 18000 # Node ID 0729c73d57617ff25da2484bc62a6030b87b3d02 # Parent 5be850a66dfcdc59c67075b37528a173a4dbbd3d For issue #18, use absolute URLs to the smilies for RSS readers. diff -r 5be850a66dfc -r 0729c73d5761 smiley/__init__.py --- a/smiley/__init__.py Sun Aug 12 09:34:56 2012 -0500 +++ b/smiley/__init__.py Sat Sep 01 15:17:40 2012 -0500 @@ -1,8 +1,7 @@ """ Smiley classes and functions. + """ -import re - from django.utils.safestring import SafeData from django.utils.html import conditional_escape diff -r 5be850a66dfc -r 0729c73d5761 smiley/models.py --- a/smiley/models.py Sun Aug 12 09:34:56 2012 -0500 +++ b/smiley/models.py Sat Sep 01 15:17:40 2012 -0500 @@ -5,6 +5,7 @@ from django.db import models from django.core.cache import cache +from django.contrib.sites.models import Site CACHE_TIMEOUT = 60 * 60 # seconds @@ -75,14 +76,16 @@ def html(self): """Returns a HTML img tag representation of the smiley.""" if self.image: - return (u'%s' % - (self.get_absolute_url(), self.title, self.title)) + site = Site.objects.get_current() + return (u'%s' % + (site.domain, self.get_absolute_url(), self.title, self.title)) return u'' html.allow_tags = True def markdown(self): """Returns a markdown representation of the smiley.""" if self.image: - return (u'![%s](%s "%s")' % - (self.title, self.get_absolute_url(), self.title)) + site = Site.objects.get_current() + return (u'![%s](http://%s%s "%s")' % + (self.title, site.domain, self.get_absolute_url(), self.title)) return u''