From 75ee6ba2f3cf9e81faa826fc8e250e68dc5151c6 Mon Sep 17 00:00:00 2001 From: Elena ``of Valhalla'' Grandi Date: Thu, 17 Aug 2017 19:38:22 +0200 Subject: Enable derived collection to set their own entry class --- lesana/collection.py | 5 +++-- 1 file 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, -- cgit v1.2.3