rql_download.twistedserver.server.CubicwebFile

class rql_download.twistedserver.server.CubicwebFile(cw_binary, attrs)[source]

A virtual cubicweb file.

Methods

__init__(cw_binary, attrs)
close() Close the file.
getAttrs() Return the attributes for the file.
readChunk(offset, length) Read from the file.
setAttrs(*args, **kwargs)
writeChunk(*args, **kwargs)
__module__ = 'rql_download.twistedserver.server'
close()[source]

Close the file.

This method returns nothing if the close succeeds immediately, or a Deferred that is called back when the close succeeds.

getAttrs()[source]

Return the attributes for the file.

This method returns a dictionary in the same format as the attrs argument to L{openFile} or a L{Deferred} that is called back with same.

Returns:

out: object :

a dictionary in the same format as the attrs argument to L{openFile} or a L{Deferred} that is called back with same.

readChunk(offset, length)[source]

Read from the file.

If EOF is reached before any data is read, raise EOFError.

This method returns the data as a string, or a Deferred that is called back with same.

Parameters:

offset: int :

an integer that is the index to start from in the file.

length: int: :

the maximum length of data to return. The actual amount returned may be less than this. For normal disk files, however, this should read the requested number (up to the end of the file).

Returns:

data: object :

the requested chunk of data.

setAttrs(*args, **kwargs)[source]
writeChunk(*args, **kwargs)[source]