예제 #1
0
    def get_context(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "thumbor.loaders.http_loader"
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        return Context(server, cfg, importer)
예제 #2
0
    def get_context(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "thumbor.loaders.http_loader"
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        return Context(server, cfg, importer)
 def get_context(self):
     file_storage_root_path = tempfile.TemporaryDirectory().name
     cfg = Config()
     cfg.USE_DIMENSIONS_WHITELIST = True
     cfg.LOADER = "thumbor.loaders.file_loader"
     cfg.FILE_LOADER_ROOT_PATH = abspath(
         join(dirname(__file__), "../fixtures/images/"))
     cfg.STORAGE = "thumbor.storages.file_storage"
     cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
     importer = Importer(cfg)
     importer.import_modules()
     return Context(None, cfg, importer)
예제 #4
0
    def get_context(self):
        cfg = Config(SECURITY_KEY="ACME-SEC")
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = self.loader_path
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, "localhost", "thumbor.conf", None, "info", None)
        server.security_key = "ACME-SEC"
        return Context(server, cfg, importer)
예제 #5
0
    def get_app(self):
        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        cfg.UPLOAD_DELETE_ALLOWED = False

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #6
0
파일: upload_vows.py 프로젝트: mal/thumbor
    def get_app(self):
        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        cfg.UPLOAD_DELETE_ALLOWED = False

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #7
0
    def get_app(self):
        cfg = Config()
        cfg.ENABLE_ORIGINAL_PHOTO_UPLOAD = True
        cfg.ORIGINAL_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = storage_path
        cfg.ALLOW_ORIGINAL_PHOTO_DELETION = False

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #8
0
    def get_app(self):
        cfg = Config()
        cfg.ENABLE_ORIGINAL_PHOTO_UPLOAD = True
        cfg.ORIGINAL_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = storage_path
        cfg.ALLOW_ORIGINAL_PHOTO_DELETION = False

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
    def get_context(self):
        cfg = Config(SECURITY_KEY="ACME-SEC")
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = self.loader_path
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, "localhost", "thumbor.conf", None,
                                  "info", None)
        server.security_key = "ACME-SEC"
        return Context(server, cfg, importer)
예제 #10
0
    def get_context(self):
        file_storage_root_path = '/tmp/thumbor/storage'
        if exists(file_storage_root_path):
            rmtree(file_storage_root_path)

        cfg = Config()
        cfg.USE_BLACKLIST = True
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = abspath(join(dirname(__file__), '../fixtures/images/'))
        cfg.STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        importer = Importer(cfg)
        importer.import_modules()
        return Context(None, cfg, importer)
예제 #11
0
    def get_context(self):
        file_storage_root_path = '/tmp/thumbor/storage'
        if exists(file_storage_root_path):
            rmtree(file_storage_root_path)

        cfg = Config()
        cfg.USE_BLACKLIST = True
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = abspath(join(dirname(__file__), '../fixtures/images/'))
        cfg.STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        importer = Importer(cfg)
        importer.import_modules()
        return Context(None, cfg, importer)
예제 #12
0
    def get_app(self):
        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PUT_ALLOWED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = storage_path
        cfg.MIN_WIDTH = 40
        cfg.MIN_HEIGHT = 40

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #13
0
    def get_context(self):
        self.default_filename = 'image'

        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path
        cfg.UPLOAD_DELETE_ALLOWED = False
        cfg.UPLOAD_PUT_ALLOWED = False
        cfg.UPLOAD_DEFAULT_FILENAME = self.default_filename

        importer = Importer(cfg)
        importer.import_modules()

        return Context(None, cfg, importer)
예제 #14
0
    def get_context(self):
        self.default_filename = 'image'

        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path
        cfg.UPLOAD_DELETE_ALLOWED = False
        cfg.UPLOAD_PUT_ALLOWED = False
        cfg.UPLOAD_DEFAULT_FILENAME = self.default_filename

        importer = Importer(cfg)
        importer.import_modules()

        return Context(None, cfg, importer)
예제 #15
0
 def get_context(self):
     file_storage_root_path = (
         tempfile.TemporaryDirectory().name  # pylint: disable=consider-using-with
     )
     cfg = Config()
     cfg.USE_BLACKLIST = True
     cfg.LOADER = "thumbor.loaders.file_loader"
     cfg.FILE_LOADER_ROOT_PATH = abspath(
         join(dirname(__file__), "../fixtures/images/")
     )
     cfg.STORAGE = "thumbor.storages.file_storage"
     cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
     importer = Importer(cfg)
     importer.import_modules()
     return Context(None, cfg, importer)
예제 #16
0
    def get_context(self):
        self.default_filename = "image"

        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PUT_ALLOWED = True
        cfg.UPLOAD_PHOTO_STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path
        cfg.UPLOAD_DEFAULT_FILENAME = self.default_filename
        cfg.MIN_WIDTH = 40
        cfg.MIN_HEIGHT = 40
        cfg.UPLOAD_MAX_SIZE = 72000

        importer = Importer(cfg)
        importer.import_modules()
        return Context(None, cfg, importer)
예제 #17
0
    def get_app(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = storage_path
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = FILE_STORAGE_ROOT_PATH
        if exists(FILE_STORAGE_ROOT_PATH):
            rmtree(FILE_STORAGE_ROOT_PATH)

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        ctx = Context(server, cfg, importer)
        application = ThumborServiceApp(ctx)

        return application
예제 #18
0
    def get_app(self):
        self.default_filename = "image"

        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PHOTO_STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        cfg.UPLOAD_DELETE_ALLOWED = True
        cfg.UPLOAD_PUT_ALLOWED = False
        cfg.UPLOAD_DEFAULT_FILENAME = self.default_filename

        importer = Importer(cfg)
        importer.import_modules()

        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #19
0
    def get_app(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = storage_path
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = FILE_STORAGE_ROOT_PATH
        if exists(FILE_STORAGE_ROOT_PATH):
            rmtree(FILE_STORAGE_ROOT_PATH)

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None,
                                  'info', None)
        server.security_key = 'ACME-SEC'
        ctx = Context(server, cfg, importer)
        application = ThumborServiceApp(ctx)

        return application
예제 #20
0
    def get_app(self):
        self.default_filename = 'image'

        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PUT_ALLOWED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        cfg.UPLOAD_DEFAULT_FILENAME = self.default_filename
        cfg.MIN_WIDTH = 40
        cfg.MIN_HEIGHT = 40
        cfg.UPLOAD_MAX_SIZE = 72000

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #21
0
    def get_app(self):
        self.default_filename = 'image'

        cfg = Config()
        cfg.UPLOAD_ENABLED = True
        cfg.UPLOAD_PUT_ALLOWED = True
        cfg.UPLOAD_PHOTO_STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path
        cfg.UPLOAD_DEFAULT_FILENAME = self.default_filename
        cfg.MIN_WIDTH = 40
        cfg.MIN_HEIGHT = 40
        cfg.UPLOAD_MAX_SIZE = 72000

        importer = Importer(cfg)
        importer.import_modules()
        ctx = Context(None, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #22
0
    def get_app(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = storage_path
        cfg.ALLOW_UNSAFE_URL = False
        cfg.ALLOW_OLD_URLS = True
        cfg.STORAGE="thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH=storage_path
        cfg.STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8891, 'localhost', 'thumbor.conf', None, 'info', None)
        server.security_key = 'ACME-SEC'
        ctx = Context(server, cfg, importer)
        application = ThumborServiceApp(ctx)

        return application
예제 #23
0
    def get_app(self):
        file_storage_root_path = '/tmp/thumbor-vows/storage'
        if exists(file_storage_root_path):
            rmtree(file_storage_root_path)

        cfg = Config()
        cfg.USE_BLACKLIST = True
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = abspath(join(dirname(__file__), 'fixtures/'))
        cfg.STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path

        importer = Importer(cfg)
        importer.import_modules()

        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'debug', None)
        ctx = Context(server, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
예제 #24
0
    def get_app(self):
        file_storage_root_path = '/tmp/thumbor-vows/storage'
        if exists(file_storage_root_path):
            rmtree(file_storage_root_path)

        cfg = Config()
        cfg.USE_BLACKLIST = True
        cfg.LOADER = "thumbor.loaders.file_loader"
        cfg.FILE_LOADER_ROOT_PATH = abspath(join(dirname(__file__), 'fixtures/'))
        cfg.STORAGE = 'thumbor.storages.file_storage'
        cfg.FILE_STORAGE_ROOT_PATH = file_storage_root_path

        importer = Importer(cfg)
        importer.import_modules()

        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'debug', None)
        ctx = Context(server, cfg, importer)
        application = ThumborServiceApp(ctx)
        return application
    def get_context(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "tests.stub_file_loader"
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path
        cfg.QUALITY = 'keep'
        cfg.SVG_DPI = 200

        self.image = 'http://test.domain/image.jpg'
        self.quoted_image = quote(self.image, safe='')
        self.transform = '400x400/smart'
        self.signature = UrlSigner(security_key="ACME-SEC").signature('%s/%s' % (self.transform, self.quoted_image))
        self.signed_prefix = "/%s/%s" % (self.signature, self.transform)
        self.full_image = "/%s/%s/%s" % (self.signature, self.transform, self.quoted_image)

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(8889, 'localhost', 'thumbor.conf', None, 'info', 'thumbor_flexible_validation.app.ThumborServiceProxy')
        server.security_key = 'ACME-SEC'
        return Context(server, cfg, importer)
    def get_context(self):
        cfg = Config(SECURITY_KEY='ACME-SEC')
        cfg.LOADER = "tests.stub_file_loader"
        cfg.STORAGE = "thumbor.storages.file_storage"
        cfg.FILE_STORAGE_ROOT_PATH = self.root_path
        cfg.QUALITY = 'keep'
        cfg.SVG_DPI = 200

        self.image = 'http://test.domain/image.jpg'
        self.quoted_image = quote(self.image, safe='')
        self.transform = '400x400/smart'
        self.signature = UrlSigner(security_key="ACME-SEC").signature(
            '%s/%s' % (self.transform, self.quoted_image))
        self.signed_prefix = "/%s/%s" % (self.signature, self.transform)
        self.full_image = "/%s/%s/%s" % (self.signature, self.transform,
                                         self.quoted_image)

        importer = Importer(cfg)
        importer.import_modules()
        server = ServerParameters(
            8889, 'localhost', 'thumbor.conf', None, 'info',
            'thumbor_flexible_validation.app.ThumborServiceProxy')
        server.security_key = 'ACME-SEC'
        return Context(server, cfg, importer)