From 24806e6ae042d0c6b8acb124f2c5f7d5f507dff6 Mon Sep 17 00:00:00 2001 From: James Turk Date: Fri, 13 Apr 2012 13:04:36 -0400 Subject: [PATCH] kernel.extract_text --- oyster/core.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/oyster/core.py b/oyster/core.py index 415718c..6b8460c 100644 --- a/oyster/core.py +++ b/oyster/core.py @@ -257,6 +257,16 @@ class Kernel(object): storage = self.storage[doc_class['storage_engine']] return storage.get(doc['versions'][-1]['storage_key']) + def extract_text(self, doc): + version = self.get_last_version(doc) + doc_class = self.doc_classes[doc['doc_class']] + try: + extract_text = doc_class['extract_text'] + except KeyError: + raise ValueError('doc_class %s missing extract_text' % + doc['doc_class']) + return extract_text(doc, version) + def _get_configured_kernel(): """ factory, gets a connection configured with oyster.conf.settings """