Package twisted :: Package python :: Module filepath :: Class FilePath
[frames | no frames]

Class FilePath

Known Subclasses:
CGIDirectory, File

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 insidpe 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.
Method Summary
  __init__(self, path)
  __getstate__(self)
  __repr__(self)
  basename(self)
  child(self, path)
  childSearchPreauth(self, *paths)
Return my first existing child with a name in 'paths'.
  exists(self)
  getatime(self)
  getContent(self)
  getctime(self)
  getmtime(self)
  getsize(self)
  globChildren(self, pattern)
Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.
  isabs(self)
  isdir(self)
  isfile(self)
  islink(self)
  listdir(self)
  makedirs(self)
  open(self, mode)
  preauthChild(self, path)
Use me if `path' might have slashes in it, but you know they're safe.
  remove(self)
  restat(self, reraise)
  setContent(self, content, ext)
  siblingExtension(self, ext)
  siblingExtensionSearch(self, *exts)
Attempt to return a path with my name, given multiple possible extensions.
  splitext(self)
  touch(self)

Class Variable Summary
class clonePath = twisted.python.filepath.FilePath
NoneType statinfo = None                                                                  

Method Details

childSearchPreauth(self, *paths)

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.

globChildren(self, pattern)

Assuming I am representing a directory, return a list of FilePaths representing my children that match the given pattern.

preauthChild(self, path)

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_).

siblingExtensionSearch(self, *exts)

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".

Class Variable Details

statinfo

Type:
NoneType
Value:
None                                                                  

Generated by Epydoc 2.0 on Sat May 15 20:08:51 2004 http://epydoc.sf.net