24 lines
472 B
Python
24 lines
472 B
Python
import re
|
|
|
|
from .parsers import RasterisedDocumentParser
|
|
|
|
|
|
class ConsumerDeclaration:
|
|
|
|
MATCHING_FILES = re.compile("^.*\.(pdf|jpe?g|gif|png|tiff?|pnm|bmp)$")
|
|
|
|
@classmethod
|
|
def handle(cls, sender, **kwargs):
|
|
return cls.test
|
|
|
|
@classmethod
|
|
def test(cls, doc):
|
|
|
|
if cls.MATCHING_FILES.match(doc.lower()):
|
|
return {
|
|
"parser": RasterisedDocumentParser,
|
|
"weight": 0
|
|
}
|
|
|
|
return None
|