Esempio n. 1
0
    def deleteDir(self, path, recursive = False):
        """ Deletes a RASS item (file on the CDN + RASS resource attached to it)

            @param string: relative path to the file on the cdn
        """
        uri = "/dir/" + path.lstrip("/")
        if recursive:
            query = Query()
            query["recursive"] = "1"
            query.feed = uri
            uri = query.ToUri()
        return self.delete(uri)
Esempio n. 2
0
    def deleteFile(self, path = None, not_if_exists = False):
        """ Delete the file instance that has the given path.

            If this causes a content instance to be no longer attached to a file instance, it is also deleted.
            Note that only metadata is deleted, use RassService.deleteItem() to delete the file from the CDN.

            @param string Relative path to the file to be deleted.
            @param bool If True, the META service will only delete the file instance if it doesn't exist on the CDN.
        """
        uri = "/file/" + self.username + "/" + path.lstrip("/")
        if not_if_exists:
            query = Query()
            query["check_cdn"] = "1"
            query.feed = uri
            uri = query.ToUri()
        return self.Delete(uri = uri)
Esempio n. 3
0
 def deleteContentDir(self, dirpath = None, delete_from_cdn = False, delete_files_only = False):
     """ Delete (recursively) all META file or/and content instances that are located under a given directory.
     
         This method deletes all file instances from inside this directory and sub-directories.
         If this causes a content instance to be no longer attached to a file instance, it is also deleted.
         Note that only metadata is deleted, use RassService.deleteDir() to delete the files from the CDN.
         
         @param string Relative path to the directory from which to delete.
         @param bool If True, the META service will only delete file/content instances if the directory doesn't exist on the CDN.
     """
     uri = "/contentdir/" + self.username + "/" + dirpath.lstrip("/")
     if not delete_from_cdn or delete_files_only:
         query = Query()
         query.feed = uri
         if not delete_from_cdn:
             query["delete_from_cdn"] = "0"
         if delete_files_only:
             query["delete_files_only"] = "1"
         uri = query.ToUri()
     return self.Delete(uri = uri)
Esempio n. 4
0
    def deleteDir(self, path, recursive = False, files_only = False):
        """ Deletes a RASS dir (directory on the CDN)

            By default, the directory will only be deleted if it is empty.
            To change this behaviour, pass True in the recursive argument.

            @param string: relative path to the file on the cdn
            @param boolean: delete the directory and all its files/subdirs
            @param boolean: only delete all files located in the directory, not the directory itself of its sub-directories.
        """
        uri = "/dir/" + path.lstrip("/")
        if recursive:
            query = Query()
            query["recursive"] = "1"
            query.feed = uri
            uri = query.ToUri()
        elif files_only:
            query = Query()
            query["files_only"] = "1"
            query.feed = uri
            uri = query.ToUri()
        return self.delete(uri)