===================================
Recipe for setting up a filestorage
===================================
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'], end='')
<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'], end='')
<zodb>
<filestorage>
path /tmp/tmpQo0DTB/db/Data.fs
</filestorage>
</zodb>
>>> recipe.install()
()
>>> import os
>>> os.listdir(d)
['db']
The update method doesn't do much, as the database part's directory
already exists, but it is present, so buildout doesn't complain and doesn't
accidentally run install() again:
>>> recipe.update()
If the storage's directory is removed, is it re-added by the update method:
>>> os.rmdir(os.path.join(d, 'db'))
>>> os.listdir(d)
[]
>>> recipe.update()
>>> os.listdir(d)
['db']
This is useful in development when the directory containing the database is
removed in order to start the database from scratch.
=======
CHANGES
=======
2.0 (2023-02-10)
----------------
- Drop support for Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6.
- Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11, PyPy3.
1.1.2 (2014-02-21)
------------------
- Fixed: packaging bug that caused 'pip install zc.recipe.filestorage' to fail
with an error about missing README.txt
1.1.1 (2014-02-16)
------------------
- Fixed: packaging bug that caused a test failure in
a test runner that didn't use buildout to run setup.py.
1.1.0 (2014-02-14)
------------------
- Python 3 compatibility
- Using Python's ``doctest`` module instead of deprecated
``zope.testing.doctest``.
- Removed 'shared-blob-dir' from blobstorage section.
1.0.0 (2007-11-03)
------------------
- Initial release.
Raw data
{
"_id": null,
"home_page": "https://pypi.org/project/zc.recipe.filestorage/",
"name": "zc.recipe.filestorage",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "zodb,zc.buildout",
"author": "Jim Fulton",
"author_email": "zope-dev@zope.dev",
"download_url": "https://files.pythonhosted.org/packages/e7/b6/d5bb0ef89885b9af2ecb83fdb3ba48d38a40dfebb6d249a1e4e3f0c453eb/zc.recipe.filestorage-2.0.tar.gz",
"platform": null,
"description": "===================================\nRecipe for setting up a filestorage\n===================================\n\nThis recipe can be used to define a file-storage. It creates a ZConfig\nfile-storage database specification that can be used by other recipes to\ngenerate ZConfig configuration files.\n\nThis recipe takes an optional path option. If none is given, it creates and\nuses a subdirectory of the buildout parts directory with the same name as the\npart.\n\nThe recipe records a zconfig option for use by other recipes.\n\nWe'll show a couple of examples, using a dictionary as a simulated buildout\nobject:\n\n >>> import zc.recipe.filestorage\n >>> buildout = dict(\n ... buildout = {\n ... 'directory': '/buildout',\n ... },\n ... db = {\n ... 'path': 'foo/Main.fs',\n ... },\n ... )\n >>> recipe = zc.recipe.filestorage.Recipe(\n ... buildout, 'db', buildout['db'])\n\n >>> print(buildout['db']['path'])\n /buildout/foo/Main.fs\n\n >>> print(buildout['db']['zconfig'], end='')\n <zodb>\n <filestorage>\n path /buildout/foo/Main.fs\n </filestorage>\n </zodb>\n\n >>> recipe.install()\n ()\n\n >>> import tempfile\n >>> d = tempfile.mkdtemp()\n >>> buildout = dict(\n ... buildout = {\n ... 'parts-directory': d,\n ... },\n ... db = {},\n ... )\n\n >>> recipe = zc.recipe.filestorage.Recipe(\n ... buildout, 'db', buildout['db'])\n\n >>> print(buildout['db']['path'])\n /tmp/tmpQo0DTB/db/Data.fs\n\n >>> print(buildout['db']['zconfig'], end='')\n <zodb>\n <filestorage>\n path /tmp/tmpQo0DTB/db/Data.fs\n </filestorage>\n </zodb>\n\n >>> recipe.install()\n ()\n\n >>> import os\n >>> os.listdir(d)\n ['db']\n\nThe update method doesn't do much, as the database part's directory\nalready exists, but it is present, so buildout doesn't complain and doesn't\naccidentally run install() again:\n\n >>> recipe.update()\n\nIf the storage's directory is removed, is it re-added by the update method:\n\n >>> os.rmdir(os.path.join(d, 'db'))\n >>> os.listdir(d)\n []\n >>> recipe.update()\n >>> os.listdir(d)\n ['db']\n\nThis is useful in development when the directory containing the database is\nremoved in order to start the database from scratch.\n\n\n=======\nCHANGES\n=======\n\n2.0 (2023-02-10)\n----------------\n\n- Drop support for Python 2.6, 2.7, 3.2, 3.3, 3.4, 3.5, 3.6.\n\n- Add support for Python 3.7, 3.8, 3.9, 3.10, 3.11, PyPy3.\n\n\n1.1.2 (2014-02-21)\n------------------\n\n- Fixed: packaging bug that caused 'pip install zc.recipe.filestorage' to fail\n with an error about missing README.txt\n\n1.1.1 (2014-02-16)\n------------------\n\n- Fixed: packaging bug that caused a test failure in\n a test runner that didn't use buildout to run setup.py.\n\n1.1.0 (2014-02-14)\n------------------\n\n- Python 3 compatibility\n\n- Using Python's ``doctest`` module instead of deprecated\n ``zope.testing.doctest``.\n\n- Removed 'shared-blob-dir' from blobstorage section.\n\n\n1.0.0 (2007-11-03)\n------------------\n\n- Initial release.\n",
"bugtrack_url": null,
"license": "ZPL 2.1",
"summary": "ZC Buildout recipe for defining a file-storage",
"version": "2.0",
"split_keywords": [
"zodb",
"zc.buildout"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7b4a7b7d12712c0d27cdd9f9016ada0d66cdd94764c77f9dc7ce4a5350d19f38",
"md5": "10ce64a63bd37c62f071437e5ea737c5",
"sha256": "de6a600e790314d8ccc932900e54746d011cccdb7e8d8e6d7ee665434a2fde0e"
},
"downloads": -1,
"filename": "zc.recipe.filestorage-2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "10ce64a63bd37c62f071437e5ea737c5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 7799,
"upload_time": "2023-02-10T09:30:07",
"upload_time_iso_8601": "2023-02-10T09:30:07.465189Z",
"url": "https://files.pythonhosted.org/packages/7b/4a/7b7d12712c0d27cdd9f9016ada0d66cdd94764c77f9dc7ce4a5350d19f38/zc.recipe.filestorage-2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e7b6d5bb0ef89885b9af2ecb83fdb3ba48d38a40dfebb6d249a1e4e3f0c453eb",
"md5": "2997329a4f71b3449ae60ac6b0832822",
"sha256": "5042205100fdf572479186a59964b261b6f1b71b1b4265e06ab70e0e4f8b7b67"
},
"downloads": -1,
"filename": "zc.recipe.filestorage-2.0.tar.gz",
"has_sig": false,
"md5_digest": "2997329a4f71b3449ae60ac6b0832822",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 7408,
"upload_time": "2023-02-10T09:30:09",
"upload_time_iso_8601": "2023-02-10T09:30:09.751463Z",
"url": "https://files.pythonhosted.org/packages/e7/b6/d5bb0ef89885b9af2ecb83fdb3ba48d38a40dfebb6d249a1e4e3f0c453eb/zc.recipe.filestorage-2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-02-10 09:30:09",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "zc.recipe.filestorage"
}