1990: image tag in html email not expanding MEDIA_URL

ma**@peek**** (Google Code) (Is this you? Claim this profile.)
chipx86
chipx86
Feb. 24, 2011
What version are you running?
1.5.3.1

What's the URL of the page containing the problem?
HTML email

What steps will reproduce the problem?
1. Post a review that sends email.

What is the expected output? What do you see instead?
Expected:
<table bgcolor=3D"#fefadf" width=3D"100%" cellspacing=3D"0" cellpadding=3D"=
8" style=3D"background-image: url('http://review.example.com/media/rb/=
images/review_request_box_top_bg.png'); background-position: left top; back=
ground-repeat: repeat-x; border: 1px black solid;">

Actual:
<table bgcolor=3D"#fefadf" width=3D"100%" cellspacing=3D"0" cellpadding=3D"=
8" style=3D"background-image: url('http://review.example.comrb/images/=
review_request_box_top_bg.png'); background-position: left top; background-=
repeat: repeat-x; border: 1px black solid;"> 

What operating system are you using? What browser?
N/A

Please provide any additional information below.
Patch attached against release-1.5.x branch
diff --git a/reviewboard/notifications/email.py b/reviewboard/notifications/email.py
index 8751a03..d15dbb2 100644
--- a/reviewboard/notifications/email.py
+++ b/reviewboard/notifications/email.py
@@ -1,6 +1,7 @@
 from datetime import datetime
 import logging
 
+from django.conf import settings
 from django.contrib.sites.models import Site
 from django.core.mail import EmailMultiAlternatives
 from django.template.loader import render_to_string
@@ -151,6 +152,7 @@ def send_review_mail(user, review_request, subject, in_reply_to,
     context['domain'] = current_site.domain
     context['domain_method'] = domain_method
     context['review_request'] = review_request
+    context['MEDIA_URL'] = settings.MEDIA_URL
     text_body = render_to_string(text_template_name, context)
     html_body = render_to_string(html_template_name, context)
 
chipx86
#1 chipx86
Fixed on release-1.5.x and master.
  • +Fixed
  • -Priority-Medium
    +Priority-Critical
    +Component-EMail
    +Milestone-Release1.5.x
  • +chipx86