diff options
author | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-08-17 19:38:22 +0200 |
---|---|---|
committer | Elena ``of Valhalla'' Grandi <valhalla@trueelena.org> | 2017-08-17 19:38:22 +0200 |
commit | 75ee6ba2f3cf9e81faa826fc8e250e68dc5151c6 (patch) | |
tree | 36e619c346279224bd0571c783a671aadd34b085 | |
parent | c2885894c06e15a5be0b6a00edd8e0de7746b4a9 (diff) |
Enable derived collection to set their own entry class
-rw-r--r-- | lesana/collection.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lesana/collection.py b/lesana/collection.py index 2ac99aa..738f6ad 100644 --- a/lesana/collection.py +++ b/lesana/collection.py @@ -96,6 +96,7 @@ class Collection(object): # This selects whether to load all other yaml files with # safe_load or load + RoundTripLoader self.safe = False + self.entry_class = Entry def _index_file(self, fname, cache): with open(os.path.join(self.itemdir, fname)) as fp: @@ -103,7 +104,7 @@ class Collection(object): data = ruamel.yaml.safe_load(fp) else: data = ruamel.yaml.load(fp, ruamel.yaml.RoundTripLoader) - entry = Entry(self, data, fname) + entry = self.entry_class(self, data, fname) doc = xapian.Document() self.indexer.set_document(doc) @@ -282,7 +283,7 @@ class Collection(object): doc.get_data(), ruamel.yaml.RoundTripLoader ) - entry = Entry( + entry = self.entry_class( self, data=data, fname=fname, |