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

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 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 Undocumented
Method moveTo Undocumented

Inherited from _PathHelper (via FilePath):

Method getContent Undocumented
Method children List the chilren of this path object.
Method walk Yield myself, then each of my children, and each of those children's children in turn.
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 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 15:57:47.