def code(self): """Return the code to embed this banner..""" return jingo.env.from_string(BANNER_TEMPLATE).render({ 'url': self.affiliate_link(), 'img': absolutify(self.image.image.url), 'alt_text': _locale(self.badge.name, self.image.locale) })
def test_basic(self): """ Test that translating a string works and doesn't change the current locale. """ activate('fr') eq_(_locale('message', 'xxx'), 'translated') eq_(get_language(), 'fr')
def preview(self): """Return the HTML to preview this banner.""" return Markup('<img src="%s?from_affiliates" alt="%s">' % (absolutify(self.image.image.url), _locale(self.badge.name, self.image.locale)))