Package Halberd :: Package clues :: Module file :: Class ClueDir

[show private | hide private]
[frames | no frames]

## Class ClueDir

Stores clues hierarchically using the underlying filesystem.

ClueDir tries to be as portable as possible but requires the host operating system to be able to create long filenames (and directories, of course).

This is an example layout:

       http___www_microsoft_com/
       http___www_microsoft_com/207_46_134_221.clu
       http___www_microsoft_com/207_46_156_220.clu
       http___www_microsoft_com/207_46_156_252.clu
               .
               .
               .

Method Summary
| ``__init__`(self, root)` Initializes ClueDir object.
| ``save`(self, url, addr, clues)` Hierarchically write clues.
| ``_mkdir`(self, dest)` Creates a directory to store clues.
| ``_sanitize`(self, url)` Filter out potentially dangerous chars.

Method Details

### __init__(self, root=None)
(Constructor)

Initializes ClueDir object.

  Parameters:
    `root` - Root folder where to start creating sub-folders.
    (type=`str`)

### save(self, url, addr, clues)

Hierarchically write clues.

  Parameters:
    `url` - URL scanned (will be used as a directory name).
    (type=`url`)
    `addr` - Address of the target.
    (type=`str`)
    `clues` - Clues to be stored.
    (type=`list`)
  Raises:
    `OSError` - If the directories can't be created.
    `IOError` - If the file can't be stored successfully.

### _mkdir(self, dest)

Creates a directory to store clues.

If the directory already exists it won't complain about that.

### _sanitize(self, url)

Filter out potentially dangerous chars.

Generated by Epydoc 2.1 on Wed Jul 18 22:25:57 2007 | http://epydoc.sf.net