Halberd.clues.file.ClueDir

Halberd :: clues :: file :: ClueDir :: Class ClueDir |
[hide private]
[frames] | no frames]

# Class ClueDir

source code

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

Instance Methods | [hide private]
__init__(self, root=None) Initializes ClueDir object. | source code
_sanitize(self, url) Filter out potentially dangerous chars. | source code
_mkdir(self, dest) Creates a directory to store clues. | source code
save(self, url, addr, clues) Hierarchically write clues. | source code

Method Details | [hide private]

### __init__(self, root=None) (Constructor) | source code
Initializes ClueDir object. Parameters: `root` (`str`) - Root folder where to start creating sub-folders.

### _mkdir(self, dest) | source code
Creates a directory to store clues. If the directory already exists it won't complain about that.

### save(self, url, addr, clues) | source code
Hierarchically write clues. Parameters: `url` (`url`) - URL scanned (will be used as a directory name). `addr` (`str`) - Address of the target. `clues` (`list`) - Clues to be stored. Raises: `OSError` - If the directories can't be created. `IOError` - If the file can't be stored successfully.