formish.filehandler

Standard filehandlers for temporary storage of file uploads. Uses tempfile to make temporary files

class formish.filehandler.TempFileHandler

Bases: formish.filehandler.FileHandlerMinimal

File handler using python tempfile module to store file

delete_file(filename)
remove the tempfile
get_mimetype(filename)
use python-magic to guess the mimetype or use application/octet-stream if no guess
get_path_for_file(filename)
given the filename, get the path for the temporary file
store_file(fieldstorage)
Given a filehandle, store the file and return an identifier, in this case the original filename
class formish.filehandler.TempFileHandlerWeb(default_url=None, resource_root='/filehandler', urlfactory=None)

Bases: formish.filehandler.TempFileHandler

Same as the temporary file handler but includes ability to include a resource and a url generator (if you want access to the temporary files on the website, e.g. for previews)

get_url_for_file(identifier)
Generate a url given an identifier

This Page

Quick search