Skip to content
This repository was archived by the owner on Jun 6, 2021. It is now read-only.

Commit ba3c5a7

Browse files
committed
feed: More sensible argument handling
1 parent a88d899 commit ba3c5a7

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

cms7/modules/feed.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self, parent, name, ftype):
1919

2020
def render(self, gs):
2121
blog = self.parent.blog.get_api(gs)
22-
feed = self.ftype(self.parent.cfg['title'], gs.url_for(self.name, absolute=True), self.parent.cfg['description'])
22+
feed = self.ftype(self.parent.title, gs.url_for(self.name, absolute=True), self.parent.description)
2323

2424
for a in reversed(blog.articles[-15:]):
2525
text = a.source.render(gs, paragraphs=3, hyphenate=False)
@@ -32,14 +32,12 @@ def render(self, gs):
3232

3333

3434
class FeedModule(Module):
35-
def __init__(self, *a, module, output, **kw):
36-
self.cfg = {}
37-
self.cfg['title'] = kw.pop('title')
38-
self.cfg['link'] = kw.pop('link')
39-
self.cfg['description'] = kw.pop('description')
40-
35+
def __init__(self, *a, title, description, module, output, **kw):
4136
super().__init__(*a, **kw)
4237

38+
self.title = title
39+
self.description = description
40+
4341
self.blog = self.config.module_id[module]
4442

4543
if not isinstance(self.blog, Blog):

0 commit comments

Comments
 (0)