当前位置: 首页>>代码示例>>Python>>正文


Python Storage.put方法代码示例

本文整理汇总了Python中thumbor.storages.mongo_storage.Storage.put方法的典型用法代码示例。如果您正苦于以下问题:Python Storage.put方法的具体用法?Python Storage.put怎么用?Python Storage.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在thumbor.storages.mongo_storage.Storage的用法示例。


在下文中一共展示了Storage.put方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: topic

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
            def topic(self):
                storage = MongoStorage(
                    Context(config=Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False))
                )
                storage.put(IMAGE_URL % 3, IMAGE_BYTES)

                return COLLECTION.find_one({"path": IMAGE_URL % 3})
开发者ID:CameronNemo,项目名称:thumbor,代码行数:9,代码来源:mongo_storage_vows.py

示例2: topic

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
            def topic(self):
                conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True)
                server = get_server('ACME-SEC')
                storage = MongoStorage(Context(config=conf, server=server))
                storage.put(IMAGE_URL % 6, IMAGE_BYTES)

                return storage.get_crypto(IMAGE_URL % 6)
开发者ID:SONIFI,项目名称:thumbor,代码行数:9,代码来源:mongo_storage_vows.py

示例3: test_before_expiration_returns_something

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
 def test_before_expiration_returns_something(self):
     rm_storage()
     options.STORAGE_EXPIRATION_SECONDS = 1000
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     assert storage.get(image_url)
开发者ID:cezarsa,项目名称:thumbor,代码行数:10,代码来源:test_mongo_storage.py

示例4: test_stores_image_does_not_store_crypt_key_if_not_in_options

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
 def test_stores_image_does_not_store_crypt_key_if_not_in_options(self):
     rm_storage()
     options.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = False
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     assert not collection.find_one({'path': image_url}).has_key('crypto'), 'crypto key should not be found into the storage'
开发者ID:cezarsa,项目名称:thumbor,代码行数:10,代码来源:test_mongo_storage.py

示例5: test_stores_image

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
 def test_stores_image(self):
     rm_storage()
     options.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = False
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     assert collection.find_one({'path': image_url}), 'image not found into the storage'
开发者ID:cezarsa,项目名称:thumbor,代码行数:10,代码来源:test_mongo_storage.py

示例6: test_get_crypto_for_url

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
    def test_get_crypto_for_url(self):
        rm_storage()
        image_url = 'www.globo.com/media/globocom/img/sprite1.png'
        http_loaded = http.load(image_url)
        storage = Storage()

        storage.put(image_url, http_loaded)

        assert storage.get_crypto(image_url) == options.SECURITY_KEY
开发者ID:cezarsa,项目名称:thumbor,代码行数:11,代码来源:test_mongo_storage.py

示例7: test_after_expiration_returns_none

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
 def test_after_expiration_returns_none(self):
     rm_storage()
     options.STORAGE_EXPIRATION_SECONDS = 1
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     time.sleep(2)
     assert storage.get(image_url) is None
开发者ID:cezarsa,项目名称:thumbor,代码行数:11,代码来源:test_mongo_storage.py

示例8: test_gets_image

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
 def test_gets_image(self):
     rm_storage()
     options.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = False
     image_url = 'www.globo.com/media/globocom/img/sprite1.png'
     http_loaded = http.load(image_url)
     storage = Storage()
     storage.put(image_url, http_loaded)
     stored_image = storage.get(image_url)
     assert stored_image and not isinstance(stored_image, dict), 'image not found into the storage'
     assert http_loaded == stored_image, 'stored image did not match the loaded one'
开发者ID:cezarsa,项目名称:thumbor,代码行数:12,代码来源:test_mongo_storage.py

示例9: topic

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
            def topic(self):
                conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=False)
                server = get_server('ACME-SEC')
                storage = MongoStorage(Context(config=conf, server=server))
                storage.put(IMAGE_URL % 11, IMAGE_BYTES)

                conf.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True
                storage.put_crypto(IMAGE_URL % 11)

                item = storage.get_crypto(IMAGE_URL % 11)
                return item.result()
开发者ID:APSL,项目名称:thumbor,代码行数:13,代码来源:mongo_storage_vows.py

示例10: test_finding_crypto_file

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
    def test_finding_crypto_file(self):
        rm_storage()
        options.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True
        options.SECURITY_KEY = 'MY-SECURITY-KEY'
        image_url = 'www.globo.com/media/globocom/img/sprite1.png'
        http_loaded = http.load(image_url)
        storage = Storage()

        storage.put(image_url, http_loaded)

        stored_crypto_key = collection.find_one({'path': image_url}).get('crypto')
        assert stored_crypto_key == options.SECURITY_KEY, '%s crypto key should be equal %s' % (stored_crypto_key, options.SECURITY_KEY)
开发者ID:cezarsa,项目名称:thumbor,代码行数:14,代码来源:test_mongo_storage.py

示例11: test_storing_an_empty_key_raises

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
    def test_storing_an_empty_key_raises(self):
        rm_storage()
        options.SECURITY_KEY = False
        options.STORES_CRYPTO_KEY_FOR_EACH_IMAGE = True
        image_url = 'www.globo.com/media/globocom/img/sprite1.png'
        http_loaded = http.load(image_url)
        storage = Storage()

        try:
            storage.put(image_url, http_loaded)
        except RuntimeError, err:
            assert str(err) == "STORES_CRYPTO_KEY_FOR_EACH_IMAGE can't be True if no SECURITY_KEY specified"
            return
开发者ID:cezarsa,项目名称:thumbor,代码行数:15,代码来源:test_mongo_storage.py

示例12: topic

# 需要导入模块: from thumbor.storages.mongo_storage import Storage [as 别名]
# 或者: from thumbor.storages.mongo_storage.Storage import put [as 别名]
            def topic(self):
                conf = Config(MONGO_STORAGE_SERVER_PORT=7777, STORES_CRYPTO_KEY_FOR_EACH_IMAGE=True)

                storage = MongoStorage(
                    Context(
                        config=conf,
                        server=get_server('ACME-SEC')
                    )
                )

                storage.put(IMAGE_URL % 5, IMAGE_BYTES)

                return self.parent.parent.collection.find_one({'path': IMAGE_URL % 5})
开发者ID:dotscreen,项目名称:thumbor,代码行数:15,代码来源:mongo_storage_vows.py


注:本文中的thumbor.storages.mongo_storage.Storage.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。