Unify the way backends are defined and loaded, unify the fs_cleanup function

This commit is contained in:
Roberto Rosario
2014-07-01 00:22:31 -04:00
parent 0255ea67b1
commit a9390d55ba
21 changed files with 208 additions and 235 deletions
-25
View File
@@ -1,28 +1,3 @@
from __future__ import absolute_import
import sys
from django.utils.importlib import import_module
from ..conf.settings import BACKEND
class BackendBase(object):
def execute(input_filename, language=None):
raise NotImplemented
def get_ocr_backend():
"""
Return the OCR backend using the path specified in the configuration
settings
"""
try:
module = import_module(BACKEND)
except ImportError:
sys.stderr.write(u'\nWarning: No OCR backend named: %s\n\n' % BACKEND)
raise
else:
return module
ocr_backend = get_ocr_backend()