<?xml version="1.0" encoding="UTF-8" ?>
<rdf:RDF xmlns="http://usefulinc.com/ns/doap#" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><Project><name>iw.recipe.fss</name>
<shortdesc>Recipe to configure File System Storage</shortdesc>
<description>=====================
iw.recipe.fss package
=====================

.. contents::

What is iw.recipe.fss ?
=======================

This recipe configure FSS Storage.


How to use iw.recipe.fss ?
==========================

The recipe is called by buildout, let's create an instance of it, with
a buildout simulated context::

    &gt;&gt;&gt; import os
    &gt;&gt;&gt; data_dir = os.path.join(test_dir, 'data')
    &gt;&gt;&gt; bin_dir = os.path.join(data_dir, 'bin')
    &gt;&gt;&gt; var_dir = os.path.join(data_dir, 'var2')
    &gt;&gt;&gt; conf_dir = os.path.join(data_dir, 'etc')
    &gt;&gt;&gt; buildout = {'instance': {'location': data_dir},
    ...		    'buildout': {'bin-directory': bin_dir}}
    &gt;&gt;&gt; name = 'fss'
    &gt;&gt;&gt; options = {'conf': os.path.join(conf_dir,
    ...			                'plone-filesystemstorage.conf'),
    ...		   'storages': """
    ...			storage1 /site/storage1
    ...			storage2 /site/storage2 flat
    ...			storage3 /site/storage3 flat %s/storage %s/backup
    ...			""" % (var_dir, var_dir)}

Creating the recipe::

    &gt;&gt;&gt; from iw.recipe.fss import Recipe
    &gt;&gt;&gt; recipe = Recipe(buildout, name, options)

Running it::

    &gt;&gt;&gt; paths = list(recipe.install())

Checking files created::

    &gt;&gt;&gt; paths.sort()
    &gt;&gt;&gt; paths
    ['...data/etc/plone-filesystemstorage.conf',
     '...data/var/fss_backup_storage1',
     '...data/var/fss_backup_storage2',
     '...data/var/fss_storage_storage1',
     '...data/var/fss_storage_storage2',
     '...data/var2/backup',
     '...data/var2/storage']

Checking the conf file::

    &gt;&gt;&gt; conf = open(os.path.join(conf_dir,
    ...			         'plone-filesystemstorage.conf'))
    &gt;&gt;&gt; print conf.read()
    # FSS conf file generated by iw.recipe.fss
    &lt;BLANKLINE&gt;
    # main storage storage1 for /site/storage1
    storage-path /.../data/var/fss_storage_storage1
    backup-path /.../data/var/fss_backup_storage1
    storage-strategy directory
    &lt;BLANKLINE&gt;
    # storage storage2
    &lt;site /site/storage2&gt;
     storage-path /.../data/var/fss_storage_storage2
     backup-path /.../data/var/fss_backup_storage2
     storage-strategy flat
    &lt;/site&gt;
    &lt;BLANKLINE&gt;
    # storage storage3
    &lt;site /site/storage3&gt;
     storage-path /.../data/var2/storage
     backup-path /.../data/var2/backup
     storage-strategy flat
    &lt;/site&gt;
    &lt;BLANKLINE&gt;
    &lt;BLANKLINE&gt;

Cleaning up the files::

    &gt;&gt;&gt; for path in paths:
    ...	    try:
    ...	        os.rmdir(path)
    ...     except:
    ...         os.remove(path)</description>
<homepage rdf:resource="http://ingeniweb.svn.sourceforge.net/viewvc/ingeniweb/iw.recipe.fss" />
<maintainer><foaf:Person><foaf:name>Ingeniweb</foaf:name>
<foaf:mbox_sha1sum>ce647768fc2915c7851be5591bf96a90966761ef</foaf:mbox_sha1sum></foaf:Person></maintainer>
<release><Version><revision>0.1c</revision></Version></release>
</Project></rdf:RDF>