def topic(self): config = Config() importer = Importer(config) config.__setitem__('COMMUNITY_EXTENSIONS', ['tc_core']) ext = Extension('tc_core') ext.add_handler('/my_handler', ImagingHandler) Extensions.register(ext) context = Context(None, config, importer) return App(context)
def topic(self): myExt = Extension('myExtension') myExt.add_module(config_key='key', class_name='class', multiple=False) myExt.add_handler('/my_route', HealthcheckHandler) return myExt
# -*- coding: utf-8 -*- # System imports # Third-party imports from derpconf.config import Config from tc_core import Extension, Extensions # Local imports from thumbor_aliases.handlers.aliases import UrlAliasesHandler extension = Extension('thumbor_aliases') # Register modules for settings extension.add_module(config_key='ALIASES_STORAGE', class_name='AliasesStorage', multiple=False) # Register main handler extension.add_handler(UrlAliasesHandler.regex(), UrlAliasesHandler) # Define settings Config.define('ALIASES_STORAGE', 'thumbor_aliases.storages.yml_file', 'Aliases storage class', 'URL Aliases') Config.define('ALIASES_STORAGE_FILE', '~/aliases.yml', 'Aliases file name') Extensions.register(extension)
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from derpconf.config import Config from tc_core import Extension, Extensions from tc_shortener.handlers.shortener import UrlShortenerHandler extension = Extension('tc_shortener') # Register the required modules extension.add_module( config_key='SHORTENER_GENERATOR', class_name='Generator', multiple=False ) extension.add_module( config_key='SHORTENER_STORAGE', class_name='Storage', multiple=False ) Config.define('SHORTENER_GENERATOR', 'tc_shortener.generators.short_generator', 'Shortened URL generator class.', 'Shortener') Config.define('SHORTENER_STORAGE', 'tc_shortener.storages.redis_storage', 'Shortened URL storage.', 'Shortener') Config.define('SHORTENER_GENERATOR_PRESERVE_NAME', True, 'Should the URL generator preserve the image name in the URL?', 'Shortener')
# -*- coding: utf-8 -*- # Copyright (c) 2016, thumbor-community, Wikimedia Foundation # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from tc_core import Extension, Extensions from wikimedia_thumbor_multi_handler.handlers.multi import MultiHandler extension = Extension('wikimedia_thumbor_multi_handler') extension.add_handler(MultiHandler.regex(), MultiHandler) Extensions.register(extension)
from tc_core import Extension, Extensions from tc_pdf.handlers.pdf import PDFHandler extension = Extension('tc_pdf') # Register the route extension.add_handler(PDFHandler.regex(), PDFHandler) Extensions.register(extension)
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community, Wikimedia Foundation # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from tc_core import Extension, Extensions from tc_purger.handlers.purger import UrlPurgerHandler extension = Extension('tc_purger') # Register the route extension.add_handler(UrlPurgerHandler.regex(), UrlPurgerHandler) Extensions.register(extension)
from tc_core import Extension, Extensions from .core import CoreHandler __all__ = ['CoreHandler'] extension = Extension('wikimedia_thumbor.handler.core') extension.add_handler(CoreHandler.regex(), CoreHandler) Extensions.register(extension)
from tc_core import Extension, Extensions from .images import ImagesHandler __all__ = ['ImagesHandler'] extension = Extension('wikimedia_thumbor.handler.images') extension.add_handler(ImagesHandler.regex(), ImagesHandler) Extensions.register(extension)
# -*- coding: utf-8 -*- # Copyright (c) 2015, thumbor-community # Use of this source code is governed by the MIT license that can be # found in the LICENSE file. from derpconf.config import Config from tc_core import Extension, Extensions from tc_shortener.handlers.shortener import UrlShortenerHandler extension = Extension('tc_shortener') # Register the required modules extension.add_module(config_key='SHORTENER_GENERATOR', class_name='Generator', multiple=False) extension.add_module(config_key='SHORTENER_STORAGE', class_name='Storage', multiple=False) Config.define('SHORTENER_GENERATOR', 'tc_shortener.generators.short_generator', 'Shortened URL generator class.', 'Shortener') Config.define('SHORTENER_STORAGE', 'tc_shortener.storages.redis_storage', 'Shortened URL storage.', 'Shortener') Config.define('SHORTENER_GENERATOR_PRESERVE_NAME', True, 'Should the URL generator preserve the image name in the URL?', 'Shortener')
from tc_core import Extension, Extensions from .healthcheck import HealthcheckHandler __all__ = ['HealthcheckHandler'] extension = Extension('wikimedia_thumbor.handler.healthcheck') extension.add_handler(HealthcheckHandler.regex(), HealthcheckHandler) Extensions.register(extension)