def _get_author_verbose(self, authors): res = [] for idx in authors: try: res.append(self.modules['authors'][idx].nickname) except lpbm.exceptions.ModelDoesNotExistError: pass return ltools.join_names(res or ['[deleted]'])
def do_authors_list(value, mod): res, template = [], _get_template('authors', 'link.html') for author_id in value: try: res.append(template.render({'author': mod[int(author_id)]})) except (lpbm.exceptions.ModelDoesNotExistError, ValueError): pass return ltools.join_names(sorted(res))
def rss_item(article): def rss_aut(author_id): try: author = self.modules['authors'][author_id] return '{email} ({full_name})'.format( email = author.email, full_name = author.full_name(), ) except lpbm.exceptions.ModelDoesNotExistError: return '[deleted]' authors = ltools.join_names([rss_aut(a) for a in article.authors]) return PyRSS2Gen.RSSItem( title = article.title, link = '{base_url}articles/{html_filename}'.format( base_url = self.modules['config']['general.url'], html_filename = article.html_filename(), ), author = authors, guid = str(article.id), description = do_markdown(article.content, code=False), pubDate = article.date, )
def rss_item(article): def rss_aut(author_id): try: author = self.modules['authors'][author_id] return '{email} ({full_name})'.format( email=author.email, full_name=author.full_name(), ) except lpbm.exceptions.ModelDoesNotExistError: return '[deleted]' authors = ltools.join_names([rss_aut(a) for a in article.authors]) return PyRSS2Gen.RSSItem( title=article.title, link='{base_url}articles/{html_filename}'.format( base_url=self.modules['config']['general.url'], html_filename=article.html_filename(), ), author=authors, guid=str(article.id), description=do_markdown(article.content, code=False), pubDate=article.date, )