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 Variables | childNotFound | Resource
used to render 404 Not Found error pages.
|
Split Table into Classes Show Methods in One Table
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 184 | Method | upgradeToVersion6 | Undocumented |
| 190 | Method | upgradeToVersion5 | Undocumented |
| 194 | Method | upgradeToVersion4 | Undocumented |
| 198 | Method | upgradeToVersion3 | Undocumented |
| 202 | Method | upgradeToVersion2 | Undocumented |
| 205 | Method | upgradeToVersion1 | Undocumented |
| 210 | Method | __init__ | Create a file with the given path. |
| 227 | Method | ignoreExt | Ignore the given extension. |
| 236 | Method | directoryListing | Undocumented |
| 243 | Method | getChild | See twisted.web.Resource.getChild. |
| 274 | Method | openForReading | Open a file and return it. |
| 278 | Method | getFileSize | Return file size. |
| 373 | Method | render | You know what you doing. |
| 432 | Method | redirect | Undocumented |
| 435 | Method | listNames | Undocumented |
| 442 | Method | listEntities | Undocumented |
| 445 | Method | createPickleChild | Undocumented |
| 461 | Method | createSimilarFile | Undocumented |
| 283 | Method | _parseRangeHeader | Return a two-tuple of the start and stop value from the given range |
| 332 | Method | _doRangeRequest | Responds to simple Range-Header requests. Simple means that only the |
Inherited from Resource:
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 74 | Method | listStaticNames | Undocumented |
| 77 | Method | listStaticEntities | Undocumented |
| 86 | Method | listDynamicNames | Undocumented |
| 89 | Method | listDynamicEntities | Undocumented |
| 92 | Method | getStaticEntity | Undocumented |
| 95 | Method | getDynamicEntity | Undocumented |
| 101 | Method | delEntity | Undocumented |
| 104 | Method | reallyPutEntity | Undocumented |
| 137 | Method | getChildWithDefault | Retrieve a static or dynamically generated child resource from me. |
| 153 | Method | getChildForRequest | Undocumented |
| 158 | Method | putChild | Register a static child. |
| 192 | Method | render_HEAD | Default handling of HEAD method. |
Inherited from Versioned:
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 187 | Method | __setstate__ | Undocumented |
| 191 | Method | __getstate__ | Get state, adding a version number to it on its way out. |
| 207 | Method | versionUpgrade | (internal) Do a version upgrade. |
Inherited from FilePath:
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 318 | Method | __getstate__ | Undocumented |
| 324 | Method | child | Undocumented |
| 336 | Method | preauthChild | Use me if `path' might have slashes in it, but you know they're safe. |
| 347 | Method | childSearchPreauth | Return my first existing child with a name in 'paths'. |
| 362 | Method | siblingExtensionSearch | Attempt to return a path with my name, given multiple possible |
| 388 | Method | realpath | Returns the absolute target as a FilePath if self is a link, self |
| 411 | Method | siblingExtension | Undocumented |
| 415 | Method | linkTo | Creates a symlink to self to at the path in the FilePath
|
| 429 | Method | open | Undocumented |
| 437 | Method | restat | Re-calculate cached effects of 'stat'. To refresh information on this path |
| 454 | Method | chmod | Changes the permissions on self, if possible. Propagates errors from |
| 466 | Method | getsize | Undocumented |
| 474 | Method | getModificationTime | Retrieve the time of last access from this file. |
| 488 | Method | getStatusChangeTime | Retrieve the time of the last status change for this file. |
| 502 | Method | getAccessTime | Retrieve the time that this file was last accessed. |
| 516 | Method | exists | Check if the path exists.
|
| 534 | Method | isdir | Undocumented |
| 543 | Method | isfile | Undocumented |
| 552 | Method | islink | Undocumented |
| 559 | Method | isabs | Undocumented |
| 562 | Method | listdir | Undocumented |
| 565 | Method | splitext | Undocumented |
| 568 | Method | __repr__ | Undocumented |
| 571 | Method | touch | Undocumented |
| 578 | Method | remove | Removes the file or directory that is represented by self. If |
| 594 | Method | makedirs | Create all directories not yet existing in path segments,
using
|
| 602 | Method | globChildren | Assuming I am representing a directory, return a list of |
| 612 | Method | basename | Undocumented |
| 615 | Method | dirname | Undocumented |
| 618 | Method | parent | Undocumented |
| 621 | Method | setContent | Undocumented |
| 632 | Method | __cmp__ | Undocumented |
| 637 | Method | createDirectory | Undocumented |
| 640 | Method | requireCreate | Undocumented |
| 643 | Method | create | Exclusively create a file, only if this file previously did not exist. |
| 656 | Method | temporarySibling | Create a path naming a temporary sibling of this path in a secure fashion. |
| 667 | Method | copyTo | Copies self to destination. |
| 739 | Method | moveTo | Move self to destination - basically renaming self to whatever |
Inherited from _PathHelper (via FilePath):
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 133 | Method | getContent | Undocumented |
| 136 | Method | children | List the chilren of this path object. |
| 193 | Method | walk | Yield myself, then each of my children, and each of those children's |
| 217 | Method | sibling | Undocumented |
| 220 | Method | segmentsFrom | Return a list of segments between a child and its ancestor. |
| 252 | Method | __hash__ | Hash the same as another FilePath with the same path as mine. |
| 260 | Method | getmtime | Deprecated. Use getModificationTime instead. |
| 267 | Method | getatime | Deprecated. Use getAccessTime instead. |
| 274 | Method | getctime | Deprecated. Use getStatusChangeTime instead. |
| Line # | Kind | Name | Docs |
|---|---|---|---|
| 632 | Method | __cmp__ | Undocumented |
| 191 | Method | __getstate__ | Get state, adding a version number to it on its way out. |
| 318 | Method | __getstate__ | Undocumented |
| 252 | Method | __hash__ | Hash the same as another FilePath with the same path as mine. |
| 210 | Method | __init__ | Create a file with the given path. |
| 568 | Method | __repr__ | Undocumented |
| 187 | Method | __setstate__ | Undocumented |
| 612 | Method | basename | Undocumented |
| 324 | Method | child | Undocumented |
| 136 | Method | children | List the chilren of this path object. |
| 347 | Method | childSearchPreauth | Return my first existing child with a name in 'paths'. |
| 454 | Method | chmod | Changes the permissions on self, if possible. Propagates errors from |
| 667 | Method | copyTo | Copies self to destination. |
| 643 | Method | create | Exclusively create a file, only if this file previously did not exist. |
| 637 | Method | createDirectory | Undocumented |
| 445 | Method | createPickleChild | Undocumented |
| 461 | Method | createSimilarFile | Undocumented |
| 101 | Method | delEntity | Undocumented |
| 236 | Method | directoryListing | Undocumented |
| 615 | Method | dirname | Undocumented |
| 516 | Method | exists | Check if the path exists.
|
| 502 | Method | getAccessTime | Retrieve the time that this file was last accessed. |
| 267 | Method | getatime | Deprecated. Use getAccessTime instead. |
| 243 | Method | getChild | See twisted.web.Resource.getChild. |
| 153 | Method | getChildForRequest | Undocumented |
| 137 | Method | getChildWithDefault | Retrieve a static or dynamically generated child resource from me. |
| 133 | Method | getContent | Undocumented |
| 274 | Method | getctime | Deprecated. Use getStatusChangeTime instead. |
| 95 | Method | getDynamicEntity | Undocumented |
| 278 | Method | getFileSize | Return file size. |
| 474 | Method | getModificationTime | Retrieve the time of last access from this file. |
| 260 | Method | getmtime | Deprecated. Use getModificationTime instead. |
| 466 | Method | getsize | Undocumented |
| 92 | Method | getStaticEntity | Undocumented |
| 488 | Method | getStatusChangeTime | Retrieve the time of the last status change for this file. |
| 602 | Method | globChildren | Assuming I am representing a directory, return a list of |
| 227 | Method | ignoreExt | Ignore the given extension. |
| 559 | Method | isabs | Undocumented |
| 534 | Method | isdir | Undocumented |
| 543 | Method | isfile | Undocumented |
| 552 | Method | islink | Undocumented |
| 415 | Method | linkTo | Creates a symlink to self to at the path in the FilePath
|
| 562 | Method | listdir | Undocumented |
| 89 | Method | listDynamicEntities | Undocumented |
| 86 | Method | listDynamicNames | Undocumented |
| 442 | Method | listEntities | Undocumented |
| 435 | Method | listNames | Undocumented |
| 77 | Method | listStaticEntities | Undocumented |
| 74 | Method | listStaticNames | Undocumented |
| 594 | Method | makedirs | Create all directories not yet existing in path segments,
using
|
| 739 | Method | moveTo | Move self to destination - basically renaming self to whatever |
| 429 | Method | open | Undocumented |
| 274 | Method | openForReading | Open a file and return it. |
| 618 | Method | parent | Undocumented |
| 336 | Method | preauthChild | Use me if `path' might have slashes in it, but you know they're safe. |
| 158 | Method | putChild | Register a static child. |
| 104 | Method | reallyPutEntity | Undocumented |
| 388 | Method | realpath | Returns the absolute target as a FilePath if self is a link, self |
| 432 | Method | redirect | Undocumented |
| 578 | Method | remove | Removes the file or directory that is represented by self. If |
| 373 | Method | render | You know what you doing. |
| 192 | Method | render_HEAD | Default handling of HEAD method. |
| 640 | Method | requireCreate | Undocumented |
| 437 | Method | restat | Re-calculate cached effects of 'stat'. To refresh information on this path |
| 220 | Method | segmentsFrom | Return a list of segments between a child and its ancestor. |
| 621 | Method | setContent | Undocumented |
| 217 | Method | sibling | Undocumented |
| 411 | Method | siblingExtension | Undocumented |
| 362 | Method | siblingExtensionSearch | Attempt to return a path with my name, given multiple possible |
| 565 | Method | splitext | Undocumented |
| 656 | Method | temporarySibling | Create a path naming a temporary sibling of this path in a secure fashion. |
| 571 | Method | touch | Undocumented |
| 205 | Method | upgradeToVersion1 | Undocumented |
| 202 | Method | upgradeToVersion2 | Undocumented |
| 198 | Method | upgradeToVersion3 | Undocumented |
| 194 | Method | upgradeToVersion4 | Undocumented |
| 190 | Method | upgradeToVersion5 | Undocumented |
| 184 | Method | upgradeToVersion6 | Undocumented |
| 207 | Method | versionUpgrade | (internal) Do a version upgrade. |
| 193 | Method | walk | Yield myself, then each of my children, and each of those children's |
| 332 | Method | _doRangeRequest | Responds to simple Range-Header requests. Simple means that only the |
| 283 | Method | _parseRangeHeader | Return a two-tuple of the start and stop value from the given range |
| Returns | A three-tuple of the start, length, and end byte of the response. | |
| Raises | ValueError | If the given Byte-Ranges-Specifier was invalid |