Source code for ciowarehouse.handlers.handler_directory
"""A file handlerxs for directories."""
from os.path import isdir
from ..lib.i18n import _
from ..lib.handler import Handler
# =============================================================================
[docs]def includeme(configurator):
"""Function to include CioWarehouse a handler.
:type configurator: pyramid.config.Configurator
:param configurator:
Object used to do configuration declaration within the application.
"""
Handler.register(configurator, HandlerDirectory)
# =============================================================================
[docs]class HandlerDirectory(Handler):
"""Class to manage a directory."""
uid = 'directory'
label = _('Generic directory handling')
# -------------------------------------------------------------------------
[docs] def match(self, extension, filename, content=None, extensions_subset=None):
"""Check whether this file handler matches with the file ``filename``.
See: :meth:`.handlers.Handler.match`
"""
return isdir(filename), content
# -------------------------------------------------------------------------
[docs] @classmethod
def thumbnails_obsolete(cls, abs_file, thumb_dir):
"""Check if thumbnails are obsolete.
See: :meth:`.handlers.Handler.thumbnails_obsolete`
"""
return False