diff --git a/docs/config.html b/docs/config.html
index 03a171e..0ed6e59 100644
--- a/docs/config.html
+++ b/docs/config.html
@@ -140,7 +140,8 @@ the predefined themes presume that at least name
is defined.
The content_type
parameter can be defined to indicate that
this subscription is a reading list, i.e., is an external list
of subscriptions. At the moment, three formats of reading lists are supported:
-opml
, foaf
, and csv
. In the future,
+opml
, foaf
, csv
, and
+config
. In the future,
support for formats like xoxo
could be added.
Normalization overrides can also be defined here.
diff --git a/planet/config.py b/planet/config.py index 9209bc9..e1325d1 100644 --- a/planet/config.py +++ b/planet/config.py @@ -193,20 +193,22 @@ def load(config_file): os.makedirs(config.cache_lists_directory()) def data2config(data, cached_config): - if content_type(list).find('opml')>=0: - opml.opml2config(data, cached_config) - elif content_type(list).find('foaf')>=0: - foaf.foaf2config(data, cached_config) - elif content_type(list).find('csv')>=0: - csv_config.csv2config(data, cached_config) - else: - from planet import shell - import StringIO - cached_config.readfp(StringIO.StringIO(shell.run( - content_type(list), data.getvalue(), mode="filter"))) + if content_type(list).find('opml')>=0: + opml.opml2config(data, cached_config) + elif content_type(list).find('foaf')>=0: + foaf.foaf2config(data, cached_config) + elif content_type(list).find('csv')>=0: + csv_config.csv2config(data, cached_config) + elif content_type(list).find('config')>=0: + cached_config.readfp(data) + else: + from planet import shell + import StringIO + cached_config.readfp(StringIO.StringIO(shell.run( + content_type(list), data.getvalue(), mode="filter"))) - if cached_config.sections() in [[], [list]]: - raise Exception + if cached_config.sections() in [[], [list]]: + raise Exception for list in reading_lists: downloadReadingList(list, parser, data2config) @@ -349,7 +351,8 @@ def reading_lists(): if parser.has_option(section, 'content_type'): type = parser.get(section, 'content_type') if type.find('opml')>=0 or type.find('foaf')>=0 or \ - type.find('csv')>=0 or type.find('.')>=0: + type.find('csv')>=0 or type.find('config')>=0 or \ + type.find('.')>=0: result.append(section) return result diff --git a/tests/data/config/rlist-config.ini b/tests/data/config/rlist-config.ini new file mode 100644 index 0000000..5d3436a --- /dev/null +++ b/tests/data/config/rlist-config.ini @@ -0,0 +1,7 @@ +[Planet] +name = CSV Test Configuration +cache_directory = tests/work/config/cache +filters = foo + +[tests/data/config/subconfig.ini] +content_type = config diff --git a/tests/data/config/subconfig.ini b/tests/data/config/subconfig.ini new file mode 100644 index 0000000..1eb4bbb --- /dev/null +++ b/tests/data/config/subconfig.ini @@ -0,0 +1,6 @@ +[feed1] +name = one + +[feed2] +name = two +filters = bar diff --git a/tests/test_subconfig.py b/tests/test_subconfig.py new file mode 100644 index 0000000..3253d1a --- /dev/null +++ b/tests/test_subconfig.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python + +from test_config_csv import ConfigCsvTest +from planet import config + +class SubConfigTest(ConfigCsvTest): + def setUp(self): + config.load('tests/data/config/rlist-config.ini')