HWRF  trunk@4391
Public Member Functions | List of all members
produtil.listing.Listing Class Reference

Imitates the shell "ls -l" program. More...

Detailed Description

Imitates the shell "ls -l" program.

Imitate ls -l, but with a longer mtime string:

1 print Listing("/usr/local")

To include files whose names begin with "." add hidden=True:

1 print Listing("/usr/local",hidden=True)

To log messages related to failures of lstat and readlink, pass a logging.Logger:

1 print Listing("/usr/local",hidden=True,logger=logger)

Definition at line 9 of file listing.py.

Inheritance diagram for produtil.listing.Listing:

Public Member Functions

def __init__
 Constructor for Listing: More...
 
def __iter__ (self)
 Iterates over filenames in the listed directory. More...
 
def iteritems (self)
 Iterates over name,data pairs in the listed directory. More...
 
def iterkeys (self)
 Iterates over filenames in the listed directory. More...
 
def list
 Updates the internal data structures with a new listing of the directory. More...
 
def __str__ (self)
 Generates an ls -l style listing of the directory. More...
 

Constructor & Destructor Documentation

def produtil.listing.Listing.__init__ (   self,
  path = ".",
  hidden = False,
  logger = None 
)

Constructor for Listing:

Parameters
pathThe directory path to list.
hiddenIf True, files with names beginning with "." are listed.
loggerA logging.Logger for error messages.

Definition at line 27 of file listing.py.

Member Function Documentation

def produtil.listing.Listing.__iter__ (   self)

Iterates over filenames in the listed directory.

Definition at line 35 of file listing.py.

def produtil.listing.Listing.__str__ (   self)

Generates an ls -l style listing of the directory.

Definition at line 84 of file listing.py.

def produtil.listing.Listing.iteritems (   self)

Iterates over name,data pairs in the listed directory.

The "data" will be a tuple containing the output of lstat and the output of readlink.

Definition at line 39 of file listing.py.

def produtil.listing.Listing.iterkeys (   self)

Iterates over filenames in the listed directory.

Definition at line 45 of file listing.py.

def produtil.listing.Listing.list (   self,
  hidden = False,
  logger = None 
)

Updates the internal data structures with a new listing of the directory.

Arguments are the same as for the constructor.

Parameters
hiddenIf True, files with names beginning with "." are listed.
loggerA logging.Logger for error messages.

Definition at line 50 of file listing.py.

Referenced by produtil.listing.Listing.__init__(), and produtil.listing.Listing.__str__().


The documentation for this class was generated from the following file: