comparison piecrust/sources/list.py @ 857:d231a10d18f9

refactor: Make the data providers and blog archives source functional. Also, because of a behaviour change in Jinja, the blog archives sources is now offering monthly archives by itself.
author Ludovic Chabant <ludovic@chabant.com>
date Thu, 08 Jun 2017 08:49:33 -0700
parents
children 8adc27285d93
comparison
equal deleted inserted replaced
856:9bb22bbe093c 857:d231a10d18f9
1 from piecrust.sources.base import ContentSource
2
3
4 class ListSource(ContentSource):
5 def __init__(self, inner_source, items):
6 super().__init__(
7 inner_source.app, inner_source.name, inner_source.config)
8
9 self.inner_source = inner_source
10 self.items = items
11
12 def openItem(self, item, mode='r', **kwargs):
13 return self.inner_source.openItem(item, mode, **kwargs)
14
15 def getItemMtime(self, item):
16 return self.inner_source.getItemMtime(item)
17
18 def getContents(self, group):
19 return self.items
20
21 def getRelatedContents(self, item, relationship):
22 return self.inner_source.getRelatedContents(item, relationship)
23
24 def findContent(self, route_params):
25 # Can't find items... we could find stuff that's not in our list?
26 raise NotImplementedError(
27 "The list source doesn't support finding items.")
28
29 def getSupportedRouteParameters(self):
30 return self.inner_source.getSupportedRouteParameters()
31