The NewsCriteria class¶
- class ferenda.NewsCriteria(basefile, feedtitle, selector=None, key=None)¶
Represents a particular subset of the documents in a repository, for the purpose of generating a news feed for that subset. These criteria objects are used by news(), and the simplest way of controlling which criteria are used for your docrepo is to override news_criteria() to make it return a list of instantiated NewsCriteria objects.
- basefile (str) – A slug-like basic text label for this subset.
- feedtitle (str) – The title for this particular news feed
- selector (callable) – Function that takes a single DocumentEntry object and returns true iff it should be included in this feed.
- key (callable) – Function that takes a single DocumentEntry object and returns a value that can be used for sorting that object. The default implementation returns the entrys updated attribute, so that the feed contains entries sorted most recently updated first.