t.w.s.File(resource.Resource, styles.Versioned, filepath.FilePath) : class documentation

Part of twisted.web.static View Source View In Hierarchy

File is a resource that represents a plain non-interpreted file (although it can look for an extension like .rpy or .cgi and hand the file to a processor for interpretation if you wish). Its constructor takes a file path.

Alternatively, you can give a directory path to the constructor. In this case the resource will represent that directory, and its children will be files underneath that directory. This provides access to an entire filesystem tree with a single Resource.

If you map the URL 'http://server/FILE' to a resource created as File('/tmp'), then http://server/FILE/ will return an HTML-formatted listing of the /tmp/ directory, and http://server/FILE/foo/bar.html will return the contents of /tmp/foo/bar.html .
Class VariableschildNotFoundResource used to render 404 Not Found error pages.
Method upgradeToVersion6 Undocumented
Method upgradeToVersion5 Undocumented
Method upgradeToVersion4 Undocumented
Method upgradeToVersion3 Undocumented
Method upgradeToVersion2 Undocumented
Method upgradeToVersion1 Undocumented
Method __init__ Create a file with the given path.
Method ignoreExt Ignore the given extension.
Method directoryListing Undocumented
Method getChild See twisted.web.Resource.getChild.
Method openForReading Open a file and return it.
Method getFileSize Return file size.
Method render You know what you doing.
Method redirect Undocumented
Method listNames Undocumented
Method listEntities Undocumented
Method createPickleChild Undocumented
Method createSimilarFile Undocumented
Method _parseRangeHeader Return a two-tuple of the start and stop value from the given range header. Raise ValueError if the header is syntactically invalid or if the Bytes-Unit is anything other than "bytes".
Method _doRangeRequest Responds to simple Range-Header requests. Simple means that only the first byte range is handled.

Inherited from Resource:

Method listStaticNames Undocumented
Method listStaticEntities Undocumented
Method listDynamicNames Undocumented
Method listDynamicEntities Undocumented
Method getStaticEntity Undocumented
Method getDynamicEntity Undocumented
Method delEntity Undocumented
Method reallyPutEntity Undocumented
Method getChildWithDefault Retrieve a static or dynamically generated child resource from me.
Method getChildForRequest Undocumented
Method putChild Register a static child.
Method render_HEAD Default handling of HEAD method.

Inherited from Versioned:

Method __setstate__ Undocumented
Method __getstate__ Get state, adding a version number to it on its way out.
Method versionUpgrade (internal) Do a version upgrade.

Inherited from FilePath:

Method __getstate__ Undocumented
Method child Undocumented
Method preauthChild Use me if `path' might have slashes in it, but you know they're safe.
Method childSearchPreauth Return my first existing child with a name in 'paths'.
Method siblingExtensionSearch Attempt to return a path with my name, given multiple possible extensions.
Method realpath No summary
Method siblingExtension Undocumented
Method linkTo No summary
Method open Undocumented
Method restat Re-calculate cached effects of 'stat'. To refresh information on this path after you know the filesystem may have changed, call this method.
Method chmod Changes the permissions on self, if possible. Propagates errors from os.chmod up.
Method getsize Undocumented
Method getModificationTime Retrieve the time of last access from this file.
Method getStatusChangeTime Retrieve the time of the last status change for this file.
Method getAccessTime Retrieve the time that this file was last accessed.
Method exists Check if the path exists.
Method isdir Undocumented
Method isfile Undocumented
Method islink Undocumented
Method isabs Undocumented
Method listdir Undocumented
Method splitext Undocumented
Method __repr__ Undocumented
Method touch Undocumented
Method remove No summary
Method makedirs Create all directories not yet existing in path segments, using os.makedirs.
Method globChildren Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
Method basename Undocumented
Method dirname Undocumented
Method parent Undocumented
Method setContent Undocumented
Method __cmp__ Undocumented
Method createDirectory Undocumented
Method requireCreate Undocumented
Method create Exclusively create a file, only if this file previously did not exist.
Method temporarySibling Create a path naming a temporary sibling of this path in a secure fashion.
Method copyTo Copies self to destination.
Method moveTo No summary

Inherited from _PathHelper (via FilePath):

Method getContent Undocumented
Method children List the chilren of this path object.
Method walk No summary
Method sibling Undocumented
Method segmentsFrom Return a list of segments between a child and its ancestor.
Method __hash__ Hash the same as another FilePath with the same path as mine.
Method getmtime Deprecated. Use getModificationTime instead.
Method getatime Deprecated. Use getAccessTime instead.
Method getctime Deprecated. Use getStatusChangeTime instead.
def upgradeToVersion6(self): (source)
def upgradeToVersion5(self): (source)
def upgradeToVersion4(self): (source)
def upgradeToVersion3(self): (source)
def upgradeToVersion2(self): (source)
def upgradeToVersion1(self): (source)
def __init__(self, path, defaultType='text/html', ignoredExts=(), registry=None, allowExt=0): (source)
Create a file with the given path.
def ignoreExt(self, ext): (source)

Ignore the given extension.

Serve file.ext if file is requested
def directoryListing(self): (source)
def getChild(self, path, request): (source)
See twisted.web.Resource.getChild.
def openForReading(self): (source)
Open a file and return it.
def getFileSize(self): (source)
Return file size.
def _parseRangeHeader(self, range): (source)
Return a two-tuple of the start and stop value from the given range header. Raise ValueError if the header is syntactically invalid or if the Bytes-Unit is anything other than "bytes".
def _doRangeRequest(self, request, (start, end)): (source)
Responds to simple Range-Header requests. Simple means that only the first byte range is handled.
ReturnsA three-tuple of the start, length, and end byte of the response.
RaisesValueErrorIf the given Byte-Ranges-Specifier was invalid
def render(self, request): (source)
You know what you doing.
def redirect(self, request): (source)
def listNames(self): (source)
def listEntities(self): (source)
def createPickleChild(self, name, child): (source)
def createSimilarFile(self, path): (source)
API Documentation for Twisted, generated by pydoctor at 2011-10-27 16:02:37.