+v3.8 (unreleased)
+ * Sluggify feed names on opmlimport.
+ * Allow Unicode letters and digits in feed names, instead of just ASCII lettters and digits.
+
v3.7 (2013-10-11)
* Fix fallback for titles that contain malformed HTML.
* Fix atomic saves to avoid garbling config and data files if the disk is full.
"""rss2email commands
"""
+import re as _re
import sys as _sys
import xml.dom.minidom as _minidom
import xml.sax.saxutils as _saxutils
raise _error.OPMLReadError() from e
if args.file:
f.close()
+ name_slug_regexp = _re.compile('[^\w\d.-]+')
for feed in new_feeds:
if feed.hasAttribute('xmlUrl'):
url = _saxutils.unescape(feed.getAttribute('xmlUrl'))
if feed.hasAttribute('text'):
text = _saxutils.unescape(feed.getAttribute('text'))
if text != url:
- name = text
+ name = name_slug_regexp.sub('-', text)
feed = feeds.new_feed(name=name, url=url)
_LOG.info('add new feed {}'.format(feed))
feeds.save()
+# -*- coding: utf-8 -*-
# Copyright (C) 2004-2013 Aaron Swartz
# Brian Lalor
# Dean Jackson
>>> feed.url
'http://example.com/feed.atom'
- Names can only contain ASCII letters, digits, and '._-'. Here the
+ Names can only contain letters, digits, and '._-'. Here the
invalid space causes an exception:
>>> Feed(name='invalid name')
...
rss2email.error.InvalidFeedName: invalid feed name 'invalid name'
+ However, you aren't restricted to ASCII letters:
+
+ >>> Feed(name='Αθήνα')
+ <Feed Αθήνα (None -> )>
+
You must define a URL:
>>> Feed(name='feed-without-a-url', to='a@b.com').run(send=False)
>>> CONFIG['DEFAULT']['to'] = ''
>>> test_section = CONFIG.pop('feed.test-feed')
+
"""
- _name_regexp = _re.compile('^[a-zA-Z0-9._-]+$')
+ _name_regexp = _re.compile('^[\w\d.-]+$')
# saved/loaded from feed.dat using __getstate__/__setstate__.
_dynamic_attributes = [