Support config.ini as a format for reading lists
This commit is contained in:
parent
4d603b6bf7
commit
d025fe59ac
@ -140,7 +140,8 @@ the predefined themes presume that at least <code>name</code> is defined.</p>
|
|||||||
<p>The <code>content_type</code> parameter can be defined to indicate that
|
<p>The <code>content_type</code> parameter can be defined to indicate that
|
||||||
this subscription is a <em>reading list</em>, i.e., is an external list
|
this subscription is a <em>reading list</em>, i.e., is an external list
|
||||||
of subscriptions. At the moment, three formats of reading lists are supported:
|
of subscriptions. At the moment, three formats of reading lists are supported:
|
||||||
<code>opml</code>, <code>foaf</code>, and <code>csv</code>. In the future,
|
<code>opml</code>, <code>foaf</code>, <code>csv</code>, and
|
||||||
|
<code>config</code>. In the future,
|
||||||
support for formats like <code>xoxo</code> could be added.</p>
|
support for formats like <code>xoxo</code> could be added.</p>
|
||||||
<p><a href="normalization.html#overrides">Normalization overrides</a> can
|
<p><a href="normalization.html#overrides">Normalization overrides</a> can
|
||||||
also be defined here.</p>
|
also be defined here.</p>
|
||||||
|
@ -199,6 +199,8 @@ def load(config_file):
|
|||||||
foaf.foaf2config(data, cached_config)
|
foaf.foaf2config(data, cached_config)
|
||||||
elif content_type(list).find('csv')>=0:
|
elif content_type(list).find('csv')>=0:
|
||||||
csv_config.csv2config(data, cached_config)
|
csv_config.csv2config(data, cached_config)
|
||||||
|
elif content_type(list).find('config')>=0:
|
||||||
|
cached_config.readfp(data)
|
||||||
else:
|
else:
|
||||||
from planet import shell
|
from planet import shell
|
||||||
import StringIO
|
import StringIO
|
||||||
@ -349,7 +351,8 @@ def reading_lists():
|
|||||||
if parser.has_option(section, 'content_type'):
|
if parser.has_option(section, 'content_type'):
|
||||||
type = parser.get(section, 'content_type')
|
type = parser.get(section, 'content_type')
|
||||||
if type.find('opml')>=0 or type.find('foaf')>=0 or \
|
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)
|
result.append(section)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
7
tests/data/config/rlist-config.ini
Normal file
7
tests/data/config/rlist-config.ini
Normal file
@ -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
|
6
tests/data/config/subconfig.ini
Normal file
6
tests/data/config/subconfig.ini
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
[feed1]
|
||||||
|
name = one
|
||||||
|
|
||||||
|
[feed2]
|
||||||
|
name = two
|
||||||
|
filters = bar
|
8
tests/test_subconfig.py
Normal file
8
tests/test_subconfig.py
Normal file
@ -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')
|
Loading…
x
Reference in New Issue
Block a user