Closed alexgarel closed 13 years ago
--- a/emencia/django/newsletter/utils/newsletter.py
+++ b/emencia/django/newsletter/utils/newsletter.py
@@ -26,7 +26,8 @@ def track_links(content, context):
soup = BeautifulSoup(content)
for link_markup in soup('a'):
- if link_markup.get('href'):
+ if ( link_markup.get('href')
+ and "offtrack" not in link_markup.get('class','').split() ):
link_href = link_markup['href']
link_title = link_markup.get('title', link_href)
link, created = Link.objects.get_or_create(url=link_href,
Hi alexgarel,
it's a good idea, thank you for the patch, but I have did some changes, I prefer use the rel attribute, than the class attribute.
Fantomas42/emencia-django-newsletter@96145ed4500d9930aa4b1ed301569701e7b0c6c8
Yep I did hesitate on using rel but feared it was more standardized and normally specify relation to the target http://en.wikipedia.org/wiki/Link_relation Class seemed to characterised the link itself explaining its rendering. Hence my choice. But nothing strongly rooted :-)
While tracking some links, my client wishes some links not to be tracked (ethical reason or avoiding to much redirects).
Here is a patch which disable tracking of links having the offtrack class.
eg. :
Won't be tracked.