Module t.w.d.fileop

Part of twisted.web2.dav View Source

WebDAV file operations

This API is considered private to static.py and is therefore subject to change.
Function delete Perform a DELETE operation on the given URI, which is backed by the given
Function copy Perform a COPY from the given source and destination filepaths.
Function move Perform a MOVE from the given source and destination filepaths.
Function put Perform a PUT of the given data stream into the given filepath.
Function mkcollection Perform a MKCOL on the given filepath.
Function rmdir Removes the directory with the given name, as well as its contents.
Function checkResponse Undocumented
def delete(uri, filepath, depth='infinity'): (source)
Perform a DELETE operation on the given URI, which is backed by the given filepath.
Parametersfilepaththe FilePath to delete.
depththe recursion Depth for the DELETE operation, which must be "infinity".
Returnsa deferred response with a status code of responsecode.NO_CONTENT if the DELETE operation succeeds.
RaisesHTTPError(containing a response with a status code of responsecode.BAD_REQUEST) if depth is not "infinity".
HTTPError(containing an appropriate response) if the delete operation fails. If filepath is a directory, the response will be a MultiStatusResponse.
def copy(source_filepath, destination_filepath, destination_uri, depth): (source)
Perform a COPY from the given source and destination filepaths. This will perform a DELETE on the destination if necessary; the caller should check and handle the overwrite header before calling copy (as in COPYMOVE.prepareForCopy).
Parameterssource_filepatha FilePath for the file to copy from.
destination_filepatha FilePath for the file to copy to.
destination_urithe URI of the destination resource.
depththe recursion Depth for the COPY operation, which must be one of "0", "1", or "infinity".
Returnsa deferred response with a status code of responsecode.CREATED if the destination already exists, or responsecode.NO_CONTENT if the destination was created by the COPY operation.
RaisesHTTPError(containing a response with a status code of responsecode.BAD_REQUEST) if depth is not "0", "1" or "infinity".
HTTPError(containing an appropriate response) if the operation fails. If source_filepath is a directory, the response will be a MultiStatusResponse.
def move(source_filepath, source_uri, destination_filepath, destination_uri, depth): (source)
Perform a MOVE from the given source and destination filepaths. This will perform a DELETE on the destination if necessary; the caller should check and handle the overwrite header before calling copy (as in COPYMOVE.prepareForCopy). Following the DELETE, this will attempt an atomic filesystem move. If that fails, a COPY operation followed by a DELETE on the source will be attempted instead.
Parameterssource_filepatha FilePath for the file to copy from.
destination_filepatha FilePath for the file to copy to.
destination_urithe URI of the destination resource.
depththe recursion Depth for the MOVE operation, which must be "infinity".
Returnsa deferred response with a status code of responsecode.CREATED if the destination already exists, or responsecode.NO_CONTENT if the destination was created by the MOVE operation.
RaisesHTTPError(containing a response with a status code of responsecode.BAD_REQUEST) if depth is not "infinity".
HTTPError(containing an appropriate response) if the operation fails. If source_filepath is a directory, the response will be a MultiStatusResponse.
def put(stream, filepath, uri=None): (source)
Perform a PUT of the given data stream into the given filepath.
Parametersstreamthe stream to write to the destination.
filepaththe FilePath of the destination file.
urithe URI of the destination resource. If the destination exists, if uri is not None, perform a DELETE operation on the destination, but if uri is None, delete the destination directly. Note that whether a put deletes the destination directly vs. performing a DELETE on the destination affects the response returned in the event of an error during deletion. Specifically, DELETE on collections must return a MultiStatusResponse under certain circumstances, whereas PUT isn't required to do so. Therefore, if the caller expects DELETE semantics, it must provide a valid uri.
Returnsa deferred response with a status code of responsecode.CREATED if the destination already exists, or responsecode.NO_CONTENT if the destination was created by the PUT operation.
RaisesHTTPError(containing an appropriate response) if the operation fails.
def mkcollection(filepath): (source)
Perform a MKCOL on the given filepath.
Parametersfilepaththe FilePath of the collection resource to create.
Returnsa deferred response with a status code of responsecode.CREATED if the destination already exists, or responsecode.NO_CONTENT if the destination was created by the MKCOL operation.
RaisesHTTPError(containing an appropriate response) if the operation fails.
def rmdir(dirname): (source)
Removes the directory with the given name, as well as its contents.
Parametersdirnamethe path to the directory to remove.
def checkResponse(response, method, *codes): (source)
Undocumented
API Documentation for twisted, generated by pydoctor.