mirror of
https://gitlab.com/chaica/feed2toot.git
synced 2024-11-23 20:11:09 +00:00
Merge branch 'accept-bozo-exceptions' into 'master'
Add a configuration option to accept bozo exceptions See merge request !8
This commit is contained in:
commit
78bac16dcf
|
@ -44,6 +44,9 @@ In order to configure Feed2toot, you need to create a feed2toot.ini file (or any
|
|||
[hashtaglist]
|
||||
several_words_hashtags_list=/etc/feed2toot/hashtags.txt
|
||||
|
||||
[feedparser]
|
||||
accept_bozo_exceptions=true
|
||||
|
||||
For the [mastodon] section:
|
||||
|
||||
- instance_url: the url of your Mastodon instance
|
||||
|
@ -74,6 +77,10 @@ For the [hashtaglist] section:
|
|||
|
||||
- several_words_hashtags_list: a path to the file containing hashtags in two or more words. Absolute path is mandatory. By default Feed2toot adds a # before every words of a hashtag. See documentation below for an example of this file.
|
||||
|
||||
for the [feedparser] section:
|
||||
|
||||
- accept_bozo_exceptions: If set to true, feed2toot will accept malformed feeds, which are rejected by default.
|
||||
|
||||
Example of the list of hash tags
|
||||
================================
|
||||
The list of hash tags is a simple text file with one hash tag composed by several words on a single line::
|
||||
|
|
|
@ -45,6 +45,13 @@ class ConfParse(object):
|
|||
config = SafeConfigParser()
|
||||
if not config.read(os.path.expanduser(pathtoconfig)):
|
||||
sys.exit('Could not read config file')
|
||||
|
||||
# The feedparser section
|
||||
if config.has_option('feedparser', 'accept_bozo_exceptions'):
|
||||
self.accept_bozo_exceptions = config.getboolean('feedparser', 'accept_bozo_exceptions')
|
||||
else:
|
||||
self.accept_bozo_exceptions = False
|
||||
|
||||
###########################
|
||||
#
|
||||
# the rss section
|
||||
|
@ -117,7 +124,8 @@ class ConfParse(object):
|
|||
if 'bozo_exception' in feed:
|
||||
bozoexception = True
|
||||
logging.warning(feed['bozo_exception'])
|
||||
continue
|
||||
if not self.accept_bozo_exceptions:
|
||||
continue
|
||||
# check if the rss feed and the rss entry are valid ones
|
||||
if 'entries' in feed:
|
||||
if rssobject and rssobject not in feed['entries'][0].keys():
|
||||
|
|
Loading…
Reference in New Issue
Block a user