Mercurial > piecrust2
diff piecrust/pipelines/records.py @ 855:448710d84121
refactor: Get the taxonomy support back to a functional state.
There's now a taxonomy content source that wraps another normal content source
like a blog posts' source. It works in tandem with a taxonomy content pipeline
that will do the heavy lifting of figuring out what kind of terms exist and
need to be baked.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 06 Jun 2017 00:26:21 -0700 |
parents | 08e02c2a2a1a |
children | 45ad976712ec |
line wrap: on
line diff
--- a/piecrust/pipelines/records.py Sun Jun 04 23:34:28 2017 -0700 +++ b/piecrust/pipelines/records.py Tue Jun 06 00:26:21 2017 -0700 @@ -40,6 +40,10 @@ self.success = True self._entries = {} + @property + def entry_count(self): + return len(self._entries) + def addEntry(self, entry): if entry.item_spec in self._entries: raise ValueError("Entry '%s' is already in the record." % @@ -50,7 +54,7 @@ return self._entries.values() def getEntry(self, item_spec): - return self._entries[item_spec] + return self._entries.get(item_spec) class MultiRecord: @@ -74,7 +78,7 @@ if r.name == record_name: return r if not auto_create: - return None + raise Exception("No such record: %s" % record_name) record = Record(record_name) self.records.append(record) return record