Ticket #5500: 0001-Fix-5500-UnicodeEncodeError-in-atom-feed.patch

File 0001-Fix-5500-UnicodeEncodeError-in-atom-feed.patch, 1.8 KB (added by ayleph, 8 years ago)
  • mediagoblin/listings/views.py

    From 741c25fd678a130fddeccf5be10d5e168575ab07 Mon Sep 17 00:00:00 2001
    From: Andrew Browning <ayleph@thisshitistemp.com>
    Date: Tue, 14 Feb 2017 01:01:48 -0500
    Subject: [PATCH] Fix #5500 UnicodeEncodeError in atom feed
    
    This simple fix allows unicode strings in the atom feed thumb and
    description fields by forcing the entire atom content string to
    unicode.
    ---
     mediagoblin/listings/views.py   | 2 +-
     mediagoblin/user_pages/views.py | 2 +-
     2 files changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/mediagoblin/listings/views.py b/mediagoblin/listings/views.py
    index fa6b5ba7..6e1528ca 100644
    a b def atom_feed(request):  
    109109        # Include a thumbnail image in content.
    110110        file_urls = get_media_file_paths(entry.media_files, request.urlgen)
    111111        if 'thumb' in file_urls:
    112             content = '<img src="{thumb}" alt='' /> {desc}'.format(
     112            content = u'<img src="{thumb}" alt='' /> {desc}'.format(
    113113                thumb=file_urls['thumb'], desc=entry.description_html)
    114114        else:
    115115            content = entry.description_html
  • mediagoblin/user_pages/views.py

    diff --git a/mediagoblin/user_pages/views.py b/mediagoblin/user_pages/views.py
    index eaae1bd7..484d27cd 100644
    a b def atom_feed(request):  
    574574        # Include a thumbnail image in content.
    575575        file_urls = get_media_file_paths(entry.media_files, request.urlgen)
    576576        if 'thumb' in file_urls:
    577             content = '<img src="{thumb}" alt='' /> {desc}'.format(
     577            content = u'<img src="{thumb}" alt='' /> {desc}'.format(
    578578                thumb=file_urls['thumb'], desc=entry.description_html)
    579579        else:
    580580            content = entry.description_html