ZC Buildout recipe for defining a file-storage
Project description
This recipe can be used to define a file-storage. It creates a ZConfig file-storage database specification that can be used by other recipes to generate ZConfig configuration files.
This recipe takes an optional path option. If none is given, it creates and uses a subdirectory of the buildout parts directory with the same name as the part.
The recipe records a zconfig option for use by other recipes.
We’ll show a couple of examples, using a dictionary as a simulated buildout object:
>>> import zc.recipe.filestorage >>> buildout = dict( ... buildout = { ... 'directory': '/buildout', ... }, ... db = { ... 'path': 'foo/Main.fs', ... }, ... ) >>> recipe = zc.recipe.filestorage.Recipe( ... buildout, 'db', buildout['db']) >>> print buildout['db']['path'] /buildout/foo/Main.fs >>> print buildout['db']['zconfig'], <zodb> <filestorage> path /buildout/foo/Main.fs </filestorage> </zodb> >>> recipe.install() () >>> import tempfile >>> d = tempfile.mkdtemp() >>> buildout = dict( ... buildout = { ... 'parts-directory': d, ... }, ... db = {}, ... ) >>> recipe = zc.recipe.filestorage.Recipe( ... buildout, 'db', buildout['db']) >>> print buildout['db']['path'] /tmp/tmpQo0DTB/db/Data.fs >>> print buildout['db']['zconfig'], <zodb> <filestorage> path /tmp/tmpQo0DTB/db/Data.fs </filestorage> </zodb> >>> recipe.install() () >>> import os >>> os.listdir(d) ['db']
To do
Add support for various file-storage options
Create a ZODB-configuration recipe that is meant to be a base class for storage recipes and provides database-configuration options.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for zc.recipe.filestorage-1.0a4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 06826bf01079cdb97c0b03a665b743cb80d252f6f30e4c0fb8270df81c934c6e |
|
MD5 | 7124b9f3ae16b28b153b40dbb0657858 |
|
BLAKE2b-256 | 2ef994ccb8e751c4f8ea8726f33b2c4cd04c4c5efda0218e13e1fc2eeb8c5663 |