Beispiel #1
0
    url = urljoin(BCS_HOST, BUCKET_NAME) + object_name
    return url, url


def delete_file(file_path):
    from urlparse import urlsplit
    from settings import BAE_BCS

    path = urlsplit(file_path).path
    _, bucket_name, object_name = path.split("/", 2)
    object_name = "/" + object_name

    err, resp = BAE_BCS.del_object(bucket_name, object_name)
    if err != 0:
        raise Exception(resp)



############################################
## memcache
############################################
from settings import ENABLE_MEMCACHE


if ENABLE_MEMCACHE:
    from bae.api.memcache import BaeMemcache

    memcache = BaeMemcache()  # bind memcache to BAE
    memcache.flush_all = lambda cls: None

Beispiel #2
0
            BAE_BCS.del_object(BUCKET_NAME, object_name)
            raise Exception(resp)

    url = urljoin(BCS_HOST, BUCKET_NAME) + object_name
    return url, url


def delete_file(file_path):
    from urlparse import urlsplit
    from settings import BAE_BCS

    path = urlsplit(file_path).path
    _, bucket_name, object_name = path.split("/", 2)
    object_name = "/" + object_name

    err, resp = BAE_BCS.del_object(bucket_name, object_name)
    if err != 0:
        raise Exception(resp)


############################################
## memcache
############################################
from settings import ENABLE_MEMCACHE

if ENABLE_MEMCACHE:
    from bae.api.memcache import BaeMemcache

    memcache = BaeMemcache()  # bind memcache to BAE
    memcache.flush_all = lambda cls: None