Fix encoding error with the feed plugin on PY2 (Ref #194)
This commit is contained in:
@@ -25,7 +25,7 @@ import os
|
||||
from datetime import datetime
|
||||
from feedgenerator import Atom1Feed, Rss201rev2Feed
|
||||
from jinja2 import Markup
|
||||
from sigal import signals
|
||||
from sigal import signals, compat
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
@@ -72,7 +72,8 @@ def generate_feed(gallery, images, feed_type=None, feed_url='', nb_items=0):
|
||||
|
||||
output_file = os.path.join(root_album.dst_path, feed_url.split('/')[-1])
|
||||
logger.info('Generate %s feeds: %s', feed_type.upper(), output_file)
|
||||
with codecs.open(output_file, 'w', 'utf-8') as f:
|
||||
encoding = 'utf-8' if not compat.PY2 else None
|
||||
with codecs.open(output_file, 'w', encoding) as f:
|
||||
feed.write(f, 'utf-8')
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
Title: WÎth spécial chÆracters
|
||||
|
||||
This is a funny description of this image
|
||||
|
||||
Reference in New Issue
Block a user