示例#1
0
 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]'])
示例#2
0
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))
示例#3
0
文件: render.py 项目: Naam/lpbm
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))
示例#4
0
文件: articles.py 项目: Naam/lpbm
 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]'])
示例#5
0
文件: render.py 项目: Naam/lpbm
 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,
     )
示例#6
0
        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,
            )