Ticket #16753: patch.diff

File patch.diff, 1.2 KB (added by cato, 13 years ago)
  • django/contrib/syndication/views.py

     
    88from django.utils.html import escape
    99
    1010def add_domain(domain, url, secure=False):
     11    if url.startswith('//'):
     12        if secure:
     13            protocol = 'https'
     14        else:
     15            protocol = 'http'
     16        url = iri_to_uri(u'%s:%s' % (protocol, url))
    1117    if not (url.startswith('http://')
    1218            or url.startswith('https://')
    1319            or url.startswith('mailto:')):
  • tests/regressiontests/syndication/tests.py

     
    303303            views.add_domain('example.com', 'mailto:uhoh@djangoproject.com'),
    304304            'mailto:uhoh@djangoproject.com'
    305305        )
     306        self.assertEqual(
     307            views.add_domain('example.com', '//example.com/foo/?arg=value'),
     308            'http://example.com/foo/?arg=value'
     309        )
Back to Top