Class t.p.f.FilePath(_PathHelper):

Part of twisted.python.filepath View Source View In Hierarchy

Known subclasses: twisted.web.static.File, twisted.web.twcgi.CGIDirectory, twisted.web2.twcgi.CGIDirectory

I am a path on the filesystem that only permits 'downwards' access.

Instantiate me with a pathname (for example, FilePath('/home/myuser/public_html')) and I will attempt to only provide access to files which reside inside that path. I may be a path to a file, a directory, or a file which does not exist.

The correct way to use me is to instantiate me, and then do ALL filesystem access through me. In other words, do not import the 'os' module; if you need to open a file, call my 'open' method. If you need to list a directory, call my 'path' method.

Even if you pass me a relative path, I will convert that to an absolute path internally.
Instance VariablesalwaysCreateWhen opening this file, only succeed if the file does not already exist. (type: bool )
Method __init__ Undocumented
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
Method siblingExtension Undocumented
Method open Undocumented
Method restat Undocumented
Method getsize Undocumented
Method getmtime Undocumented
Method getctime Undocumented
Method getatime Undocumented
Method exists Undocumented
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 Undocumented
Method makedirs Undocumented
Method globChildren Assuming I am representing a directory, return a list of
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:

Method getContent Undocumented
Method children Undocumented
Method walk Yield myself, then each of my children, and each of those children's
Method sibling Undocumented
Method segmentsFrom Return a list of segments between a child and its ancestor.
def __init__(self, path, alwaysCreate=False): (source)
Undocumented
def __getstate__(self): (source)
Undocumented
def child(self, path): (source)
Undocumented
def preauthChild(self, path): (source)

Use me if `path' might have slashes in it, but you know they're safe.

(NOT slashes at the beginning. It still needs to be a _child_).
def childSearchPreauth(self, *paths): (source)

Return my first existing child with a name in 'paths'.

paths is expected to be a list of *pre-secured* path fragments; in most cases this will be specified by a system administrator and not an arbitrary user.

If no appropriately-named children exist, this will return None.
def siblingExtensionSearch(self, *exts): (source)

Attempt to return a path with my name, given multiple possible extensions.

Each extension in exts will be tested and the first path which exists will be returned. If no path exists, None will be returned. If '' is in exts, then if the file referred to by this path exists, 'self' will be returned.

The extension '*' has a magic meaning, which means "any path that begins with self.path+'.' is acceptable".
def siblingExtension(self, ext): (source)
Undocumented
def open(self, mode='r'): (source)
Undocumented
def restat(self, reraise=True): (source)
Undocumented
def getsize(self): (source)
Undocumented
def getmtime(self): (source)
Undocumented
def getctime(self): (source)
Undocumented
def getatime(self): (source)
Undocumented
def exists(self): (source)
Undocumented
def isdir(self): (source)
Undocumented
def isfile(self): (source)
Undocumented
def islink(self): (source)
Undocumented
def isabs(self): (source)
Undocumented
def listdir(self): (source)
Undocumented
def splitext(self): (source)
Undocumented
def __repr__(self): (source)
Undocumented
def touch(self): (source)
Undocumented
def remove(self): (source)
Undocumented
def makedirs(self): (source)
Undocumented
def globChildren(self, pattern): (source)
Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
def basename(self): (source)
Undocumented
def dirname(self): (source)
Undocumented
def parent(self): (source)
Undocumented
def setContent(self, content, ext='.new'): (source)
Undocumented
def __cmp__(self, other): (source)
Undocumented
def createDirectory(self): (source)
Undocumented
def requireCreate(self, val=1): (source)
Undocumented
def create(self): (source)
Exclusively create a file, only if this file previously did not exist.
def temporarySibling(self): (source)
Create a path naming a temporary sibling of this path in a secure fashion.
def copyTo(self, destination): (source)
Undocumented
def moveTo(self, destination): (source)
Undocumented
API Documentation for twisted, generated by pydoctor.