From: W. Trevor King Date: Sun, 13 Oct 2013 22:18:06 +0000 (-0700) Subject: feed: Adjust Feed._name_regexp to allow non-ASCII characters X-Git-Tag: v3.8~1^2~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=09679fd1a3281a28a652b258670b1071c3f47193;p=rss2email.git feed: Adjust Feed._name_regexp to allow non-ASCII characters There's no need to restrict folks to the Latin alphabet. Signed-off-by: W. Trevor King --- diff --git a/rss2email/command.py b/rss2email/command.py index aca5de8..038b83f 100644 --- a/rss2email/command.py +++ b/rss2email/command.py @@ -132,7 +132,7 @@ def opmlimport(feeds, args): raise _error.OPMLReadError() from e if args.file: f.close() - name_slug_regexp = _re.compile('[^a-zA-Z0-9._-]+') + name_slug_regexp = _re.compile('[^\w\d.-]+') for feed in new_feeds: if feed.hasAttribute('xmlUrl'): url = _saxutils.unescape(feed.getAttribute('xmlUrl')) diff --git a/rss2email/feed.py b/rss2email/feed.py index 259807c..a11f6c7 100644 --- a/rss2email/feed.py +++ b/rss2email/feed.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (C) 2004-2013 Aaron Swartz # Brian Lalor # Dean Jackson @@ -110,7 +111,7 @@ class Feed (object): >>> 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') @@ -118,6 +119,11 @@ class Feed (object): ... rss2email.error.InvalidFeedName: invalid feed name 'invalid name' + However, you aren't restricted to ASCII letters: + + >>> Feed(name='Αθήνα') + )> + You must define a URL: >>> Feed(name='feed-without-a-url', to='a@b.com').run(send=False) @@ -130,8 +136,9 @@ class Feed (object): >>> 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 = [