pyrax
Python Bindings for the Rackspace Cloud
 All Classes Namespaces Files Functions Variables Properties
Public Member Functions | Static Public Attributes
SelfDeletingTempDirectory Class Reference

Convenience class for dealing with temporary folders and the files within them. More...

List of all members.

Public Member Functions

def __enter__
def __exit__

Static Public Attributes

 name = None

Detailed Description

Convenience class for dealing with temporary folders and the files within them.

The temp folder is created in a secure fashion, and is automatically deleted when the context manager exits, along with any files that may be contained within. When you instantiate this class, you receive the full path to the temporary directory.

Usage:

     with SelfDeletingTempDirectory() as tmpdir:
         f1 = open(os.path.join(tmpdir, "my_file.txt", "w")
         f1.write("blah...")
         f1.close()
         some_func(tmpdir)
     # More code
     # At this point, the directory 'tmpdir' has been deleted,
     # as well as the file 'f1' within it.

Member Function Documentation

def __enter__ (   self)
def __exit__ (   self,
  type,
  value,
  traceback 
)

Member Data Documentation

name = None [static]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Properties