Ejemplo n.º 1
0
def delete_thumbs(item):
    """Delete the thumbnails associated with the given item.

    :param item: A 2-tuple with a subdir name and an ID. If given a
        ORM mapped class with _thumb_dir and id attributes, the info
        can be extracted automatically.
    :type item: ``tuple`` or mapped class instance
    """
    image_dir, item_id = _normalize_thumb_item(item)
    thumbs = thumb_paths(item, exists=True).itervalues()
    delete_files(thumbs, image_dir)
Ejemplo n.º 2
0
def delete_thumbs(item):
    """Delete the thumbnails associated with the given item.

    :param item: A 2-tuple with a subdir name and an ID. If given a
        ORM mapped class with _thumb_dir and id attributes, the info
        can be extracted automatically.
    :type item: ``tuple`` or mapped class instance
    """
    image_dir, item_id = _normalize_thumb_item(item)
    thumbs = thumb_paths(item, exists=True).itervalues()
    delete_files(thumbs, image_dir)
Ejemplo n.º 3
0
    def delete(self, unique_id):
        """Delete the stored file represented by the given unique ID.

        :type unique_id: unicode
        :param unique_id: The identifying string for this file.
        :rtype: boolean
        :returns: True if successful, False if an error occurred.

        """
        file_path = self._get_path(unique_id)
        return delete_files([file_path], 'media')
Ejemplo n.º 4
0
def delete_thumbs(item):
    """Delete the thumbnails associated with the given item.

    :param item: A 2-tuple with a subdir name and an ID. If given a
        ORM mapped class with _thumb_dir and id attributes, the info
        can be extracted automatically.
    :type item: ``tuple`` or mapped class instance
    """
    image_dir, item_id = _normalize_thumb_item(item)
    thumbs = thumb_paths(item, exists=True).itervalues()
    delete_files(thumbs, image_dir)

    #Delete swift thumbs
    thumbs = swift_thumb_paths(item, exists=True).itervalues()
    swift = _connect()
    for thumb in thumbs:
        try:
            swift.delete_object(config['swift_container'], thumb)
        except Exception, e:
            log.exception(e)