End user announcements¶
The static list of news items, shown to the user after the login.
Each item is a reStructuredText snippet, translated with the usual gettext machinery and
rendered as an HTML fragment by get_news_for_user().
- sol.news.get_news_for_user(user: User) tuple[int, str]¶
Render the news items the given user has not seen yet.
- Parameters:
user -- a
Userinstance, whoselastseennewsslot says how many items ofNEWShave already been seen- Return type:
a tuple of two items,
(count, html)
Return the number of rendered items and an HTML fragment containing them, the most recent first, or
(0, '')when there is nothing new for the user.A malformed snippet is logged and skipped, without preventing the other items from being shown.
- sol.news.render_news_item(source: str) str¶
Render the given reStructuredText source as an HTML fragment.
- sol.news.NEWS: tuple[TranslationString, ...]¶
The set of news that are shown to the user when he logs in.
New items must be appended, never inserted in the middle: the position of an item identifies it, and the
User.lastseennewsattribute of theUserrecords how many of them the user has already seen.