convert hds module to browser2 and fix it
This commit is contained in:
parent
94cea6458b
commit
89e7bbe9ef
4 changed files with 114 additions and 163 deletions
|
|
@ -40,12 +40,11 @@ class HDSModule(Module, CapMessages):
|
|||
#### CapMessages ##############################################
|
||||
|
||||
def iter_threads(self):
|
||||
with self.browser:
|
||||
for story in self.browser.iter_stories():
|
||||
thread = Thread(story.id)
|
||||
thread.title = story.title
|
||||
thread.date = story.date
|
||||
yield thread
|
||||
for story in self.browser.iter_stories():
|
||||
thread = Thread(story.id)
|
||||
thread.title = story.title
|
||||
thread.date = story.date
|
||||
yield thread
|
||||
|
||||
GENDERS = ['<unknown>', 'boy', 'girl', 'transexual']
|
||||
|
||||
|
|
@ -56,8 +55,7 @@ class HDSModule(Module, CapMessages):
|
|||
else:
|
||||
thread = None
|
||||
|
||||
with self.browser:
|
||||
story = self.browser.get_story(id)
|
||||
story = self.browser.get_story(id)
|
||||
|
||||
if not story:
|
||||
return None
|
||||
|
|
@ -80,7 +78,7 @@ class HDSModule(Module, CapMessages):
|
|||
parent=None,
|
||||
content=story.body,
|
||||
children=[],
|
||||
signature='Written by a %s (%s)' % (self.GENDERS[story.author.sex], story.author.email),
|
||||
signature=u'Written by a %s in category %s' % (self.GENDERS[story.author.sex], story.category),
|
||||
flags=flags)
|
||||
|
||||
return thread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue