def __init__(self, file_storage=None, crypto_storage=None): if file_storage: self.file_storage = file_storage else: self.file_storage = real_import(conf.MIXED_STORAGE_FILE_STORAGE).Storage() if file_storage: self.crypto_storage = crypto_storage else: self.crypto_storage = real_import(conf.MIXED_STORAGE_CRYPTO_STORAGE).Storage()
def __init__(self, conf_file=None, security_key=None, custom_handlers=None): if conf_file is None: conf_file = ThumborServiceApp.get_conf_file(conf_file) logger.info('Config file: %s' % conf_file) parse_config_file(conf_file) self.loader = real_import(conf.LOADER) self.storage = real_import(conf.STORAGE) self.engine = real_import(conf.ENGINE) self.detectors = [real_import(detector_name).Detector for detector_name in conf.DETECTORS] self.filters = [real_import(filter_name).Filter for filter_name in conf.FILTERS] filters.compile_filters(self.filters) # run again to overwrite the default settings on the # imported modules with the ones defined into the config file parse_config_file(conf_file) #storage = storage.Storage() #self.engine = self.engine.Engine() if security_key: options.SECURITY_KEY = security_key handler_context = { 'loader': self.loader, 'storage': self.storage, 'engine': self.engine, 'detectors': self.detectors, 'filters': self.filters } handlers = [ (r'/healthcheck', HealthcheckHandler) ] if conf.ALLOW_UNSAFE_URL: handlers.append( (Url.regex(), MainHandler, handler_context), ) if custom_handlers: for handler in custom_handlers: handlers.append((handler[0], handler[1], handler_context)) else: handlers.append( (r'/(?P<crypto>[^/]+)/(?P<image>(.+))', CryptoHandler, handler_context) ) super(ThumborServiceApp, self).__init__(handlers)
def __init__(self, conf_file=None, custom_handlers=None): if conf_file is None: conf_file = ThumborServiceApp.get_conf_file(conf_file) logger.info('Config file: %s' % conf_file) parse_config_file(conf_file) loader = real_import(options.LOADER) storage = real_import(options.STORAGE) engine = real_import(options.ENGINE) detectors = [ real_import(detector_name).Detector for detector_name in options.DETECTORS ] filters = [ real_import(filter_name).Filter for filter_name in options.FILTERS ] # run again to overwrite the default settings on the # imported modules with the ones defined into the config file parse_config_file(conf_file) storage = storage.Storage() engine = engine.Engine() handler_context = { 'loader': loader, 'storage': storage, 'engine': engine, 'detectors': detectors, 'filters': filters } handlers = [(r'/healthcheck', HealthcheckHandler)] if options.ALLOW_UNSAFE_URL: handlers.append((Url.regex(), MainHandler, handler_context), ) if custom_handlers: for handler in custom_handlers: handlers.append((handler[0], handler[1], handler_context)) else: handlers.append((r'/(?P<crypto>[^/]+)/(?P<image>(.+))', EncryptedHandler, handler_context)) super(ThumborServiceApp, self).__init__(handlers)
def __init__(self, conf_file=None): if conf_file is None: conf_file = ThumborServiceApp.get_conf_file(conf_file) logger.info('Config file: %s' % conf_file) parse_config_file(conf_file) loader = real_import(options.LOADER) storage = real_import(options.STORAGE) engine = real_import(options.ENGINE) detectors = [] for detector_name in options.DETECTORS: detectors.append(real_import(detector_name).Detector) # run again to overwrite the default settings on the # imported modules with the ones defined into the config file parse_config_file(conf_file) storage = storage.Storage() engine = engine.Engine() handler_context = { 'loader': loader, 'storage': storage, 'engine': engine, 'detectors': detectors } handlers = [ (r'/healthcheck', HealthcheckHandler) ] if options.ALLOW_UNSAFE_URL: handlers.append( (Url.regex(), MainHandler, handler_context), ) handlers.append( (r'/(?P<crypto>[^/]+)/(?P<image>(.+))', EncryptedHandler, handler_context) ) super(ThumborServiceApp, self).__init__(handlers)
def topic(self): return real_import('thumbor.utils')
def topic(self): return real_import('pyvows')