예제 #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,
            )