Permalink
Browse files

Fixed SITE_URL in refund crons for mkt (747131)

  • Loading branch information...
1 parent 7e27bc6 commit f0ae64f455a8dc6825cdd40ff1c2f7805778023e @robhudson robhudson committed Apr 26, 2012
View
@@ -328,11 +328,13 @@ def json(s):
@register.filter
-def absolutify(url):
+def absolutify(url, site=None):
"""Takes a URL and prepends the SITE_URL"""
if url.startswith('http'):
return url
else:
+ if site:
+ return site + url
return settings.SITE_URL + url
View
@@ -59,7 +59,8 @@ def mail_pending_refunds():
(email, ', '.join([str(i) for i in addon_ids])))
addons = Addon.objects.filter(pk__in=addon_ids)
is_webapp = addons[0].is_webapp()
- ctx = {'addons': addons, 'refunds': pending}
+ site_url = mkt_settings.SITE_URL if is_webapp else settings.SITE_URL
+ ctx = {'addons': addons, 'refunds': pending, 'site_url': site_url}
from_email = (settings.NOBODY_EMAIL if is_webapp
else mkt_settings.NOBODY_EMAIL)
send_mail_jinja('Pending refund requests at the Mozilla Marketplace',
@@ -2,7 +2,7 @@ You have products at the Mozilla Marketplace that have pending refund requests a
{% for addon in addons %}
{{ addon.name }} ({{ ngettext('{0} request', '{0} requests', refunds[addon.pk])|f(refunds[addon.pk]) }})
- {{ addon.get_dev_url('refunds')|absolutify }}
+ {{ addon.get_dev_url('refunds')|absolutify(site_url) }}
{% endfor %}
Thanks for your prompt response. Your customers will appreciate it!
@@ -1,11 +1,12 @@
from datetime import datetime, timedelta
+from django.conf import settings
from django.core import mail
+import mock
from nose.tools import eq_
import amo
-from amo.helpers import absolutify
import amo.tests
from addons.models import Addon, AddonUser
from market.cron import clean_out_addonpremium, mail_pending_refunds
@@ -100,6 +101,7 @@ def test_two_addons(self):
eq_(len(mail.outbox), 1)
eq_(mail.outbox[0].body.count('1 request'), 2)
+ @mock.patch.object(settings, 'SITE_URL', 'not.this.domain.com')
def test_email_escaping(self):
self.webapp.name = 'You <3 My App'
self.webapp.save()
@@ -108,5 +110,5 @@ def test_email_escaping(self):
email = mail.outbox[0]
assert str(self.webapp.name) in email.body
assert '1 request' in email.body
- assert absolutify(self.webapp.get_dev_url('refunds')) in email.body
+ assert not 'not.this.domain.com' in email.body
assert [self.author.email] == email.to

0 comments on commit f0ae64f

Please sign in to comment.