formalchemy.ext.fsblob – File system renderer

This extension is used to store binary files/images on filesystem and only store the file path in the database.

This page present a Pylons integration but it should work on most framework.

Renderers

Usage

You must override the storage_path attribute:

# -*- coding: utf-8 -*-
from pylons import config
from pylonsapp import model
from pylonsapp.forms import FieldSet
from formalchemy.ext.fsblob import FileFieldRenderer

Files = FieldSet(model.Files)
Files.configure(options=[Files.path.with_renderer(
        FileFieldRenderer.new(
            storage_path=config['app_conf']['storage_path'],
            url_prefix='/'))])


As you can see, you can use it like all fields in the .configure method.

Validators

Work like all validators.

Sample app

You can have a look at the complete source of the application used for FA’s testing.