Products.BTreeFolder2


NameProducts.BTreeFolder2 JSON
Version 5.0 PyPI version JSON
download
home_pagehttps://github.com/zopefoundation/Products.BTreeFolder2
SummaryA BTree based implementation for Zope's OFS.
upload_time2023-02-01 08:59:22
maintainer
docs_urlNone
authorZope Foundation and Contributors
requires_python>=3.7
licenseZPL 2.1
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Overview
========

BTreeFolder2 is a Zope product that acts like a Zope 2 OFS folder but can
store many more items.

When you fill a Zope folder with too many items, both Zope and your
browser get overwhelmed.  Zope has to load and store a large folder
object, and the browser has to render large HTML tables repeatedly.
Zope can store a lot of objects, but it has trouble storing a lot of
objects in a single standard folder.

Zope Corporation once had an extensive discussion on the subject.  It
was decided that we would expand standard folders to handle large
numbers of objects gracefully.  Unfortunately, Zope folders are used
and extended in so many ways today that it would be difficult to
modify standard folders in a way that would be compatible with all
Zope products.

So the BTreeFolder product was born.  It stored all subobjects in a
ZODB BTree, a structure designed to allow many items without loading
them all into memory.  It also rendered the contents of the folder as
a simple select list rather than a table.  Most browsers have no
trouble rendering large select lists.

But there was still one issue remaining.  BTreeFolders still stored
the ID of all subobjects in a single database record.  If you put tens
of thousands of items in a single BTreeFolder, you would still be
loading and storing a multi-megabyte folder object.  Zope can do this,
but not quickly, and not without bloating the database.

BTreeFolder2 solves this issue.  It stores not only the subobjects but
also the IDs of the subobjects in a BTree.  It also batches the list
of items in the UI, showing only 1000 items at a time.  So if you
write your application carefully, you can use a BTreeFolder2 to store
as many items as will fit in physical storage.

There are products that depend on the internal structure of the
original BTreeFolder, however.  So rather than risk breaking those
products, the product has been renamed.  You can have both products
installed at the same time.  If you're developing new applications,
you should use BTreeFolder2.


Usage
=====

The BTreeFolder2 user interface shows a list of items rather than a
series of checkboxes. To visit an item, select it in the list and
click the "edit" button.

BTreeFolder2 objects provide Python dictionary-like methods to make them
easier to use in Python code than standard folders::

    has_key(key)
    keys()
    values()
    items()
    get(key, default=None)
    __len__()

keys(), values(), and items() return sequences, but not necessarily
tuples or lists.  Use len(folder) to call the __len__() method.  The
objects returned by values() and items() have acquisition wrappers.

BTreeFolder2 also provides a method for generating unique,
non-overlapping IDs::

    generateId(prefix='item', suffix='', rand_ceiling=999999999)

The ID returned by this method is guaranteed to not clash with any
other ID in the folder.  Use the returned value as the ID for new
objects.  The generated IDs tend to be sequential so that objects that
are likely related in some way get loaded together.

BTreeFolder2 implements the full Folder interface, with the exception
that the superValues() method does not return any items.  To implement
the method in the way the Zope codebase expects would undermine the
performance benefits gained by using BTreeFolder2.

Changelog
=========

5.0 (2023-02-01)
----------------

- Drop support for Python 2.7, 3.5, 3.6.


4.4 (2022-12-16)
----------------

- Fix Python 2 incompatibility.

- Fix insidious buildout configuration bug for tests against Zope 4.

- Add support for Python 3.10 and 3.11.


4.3 (2021-04-26)
----------------

- Add support for Python 3.9

- Modernize the ZMI template to match the Zope 4 styles
  (`#10 <https://github.com/zopefoundation/Products.BTreeFolder2/issues/10>`_)

- Add ``Delete All Objects`` button to the manage screen.
  (`#9 <https://github.com/zopefoundation/Products.BTreeFolder2/issues/9>`_)


4.2 (2019-03-08)
----------------

- Specify supported Python versions using ``python_requires`` in setup.py
  (`Zope#481 <https://github.com/zopefoundation/Zope/issues/481>`_)

- Drop support for Python 3.4 since Zope itself does not support it.

- Add support for Python 3.8


4.1 (2018-10-05)
----------------

- More PEP8 compliance.

- Add icon for Bootstrap ZMI.

- Avoid deprecation warnings by using current API.

- Add support for Python 3.7.


4.0.0 (2017-05-23)
------------------

- added tox configuration

- Python 3 compatibility

- Update to require and be compatible with Zope 4.

3.0 (2016-07-18)
----------------

- Update Dependencies (no ZODB, but BTrees)

2.14.0 (2015-06-18)
-------------------

- Require ExtensionClass >= 4.1a1 (Compatible w/ Zope 4).

2.13.5 (2015-06-18)
-------------------

- Added case for clean-up routine where the meta type index contains
  keys that are not in the tree.

2.13.4 (2011-12-12)
-------------------

- Provide security declaration for `BTreeFolder2Base.hasObject` method.

- Add some tests for correct `getattr` behavior.

- Minor `__getattr__` and `_getOb` optimizations.

2.13.3 (2011-03-15)
-------------------

- `keys`, `values` and `items` methods are now exactly the same as
  `objectIds`, `objectValues` and `objectItems`. They did the same before
  already but duplicated the code.

2.13.2 (2011-03-08)
-------------------

- `objectValues` and `objectItems` no longer do a special handling when no
  special `spec` is requested as `objectIds` already does the correct
  handling.

2.13.1 (2010-08-04)
-------------------

- Make sure that methods returning objects return them Acquisition wrapped.

- Be more careful in calling our own keys, values and items methods, as
  sub-classes might have overridden some of them.

2.13.0 (2010-07-11)
-------------------

- Changed the `objectIds`, `objectItems` and `objectValues` methods to use the
  internal OOBTree methods directly if no `spec` argument is passed.

- Change implementation of `keys`, `items` and `values` method to access the
  `self._tree` OOBTree methods directly. This avoids lookups in the meta_types
  structures.

- Implement the full dictionary protocol including `__getitem__`,
  `__delitem__`, `__setitem__`, `__nonzero__`, `__iter__` and `__contains__`.

- Released as separate package.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/zopefoundation/Products.BTreeFolder2",
    "name": "Products.BTreeFolder2",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "",
    "author": "Zope Foundation and Contributors",
    "author_email": "zope-dev@zope.dev",
    "download_url": "https://files.pythonhosted.org/packages/15/4c/15e48b79fdef3337e8fd2a453ad9a056b0c8c33317ff5d8d7abef5466c94/Products.BTreeFolder2-5.0.tar.gz",
    "platform": null,
    "description": "Overview\n========\n\nBTreeFolder2 is a Zope product that acts like a Zope 2 OFS folder but can\nstore many more items.\n\nWhen you fill a Zope folder with too many items, both Zope and your\nbrowser get overwhelmed.  Zope has to load and store a large folder\nobject, and the browser has to render large HTML tables repeatedly.\nZope can store a lot of objects, but it has trouble storing a lot of\nobjects in a single standard folder.\n\nZope Corporation once had an extensive discussion on the subject.  It\nwas decided that we would expand standard folders to handle large\nnumbers of objects gracefully.  Unfortunately, Zope folders are used\nand extended in so many ways today that it would be difficult to\nmodify standard folders in a way that would be compatible with all\nZope products.\n\nSo the BTreeFolder product was born.  It stored all subobjects in a\nZODB BTree, a structure designed to allow many items without loading\nthem all into memory.  It also rendered the contents of the folder as\na simple select list rather than a table.  Most browsers have no\ntrouble rendering large select lists.\n\nBut there was still one issue remaining.  BTreeFolders still stored\nthe ID of all subobjects in a single database record.  If you put tens\nof thousands of items in a single BTreeFolder, you would still be\nloading and storing a multi-megabyte folder object.  Zope can do this,\nbut not quickly, and not without bloating the database.\n\nBTreeFolder2 solves this issue.  It stores not only the subobjects but\nalso the IDs of the subobjects in a BTree.  It also batches the list\nof items in the UI, showing only 1000 items at a time.  So if you\nwrite your application carefully, you can use a BTreeFolder2 to store\nas many items as will fit in physical storage.\n\nThere are products that depend on the internal structure of the\noriginal BTreeFolder, however.  So rather than risk breaking those\nproducts, the product has been renamed.  You can have both products\ninstalled at the same time.  If you're developing new applications,\nyou should use BTreeFolder2.\n\n\nUsage\n=====\n\nThe BTreeFolder2 user interface shows a list of items rather than a\nseries of checkboxes. To visit an item, select it in the list and\nclick the \"edit\" button.\n\nBTreeFolder2 objects provide Python dictionary-like methods to make them\neasier to use in Python code than standard folders::\n\n    has_key(key)\n    keys()\n    values()\n    items()\n    get(key, default=None)\n    __len__()\n\nkeys(), values(), and items() return sequences, but not necessarily\ntuples or lists.  Use len(folder) to call the __len__() method.  The\nobjects returned by values() and items() have acquisition wrappers.\n\nBTreeFolder2 also provides a method for generating unique,\nnon-overlapping IDs::\n\n    generateId(prefix='item', suffix='', rand_ceiling=999999999)\n\nThe ID returned by this method is guaranteed to not clash with any\nother ID in the folder.  Use the returned value as the ID for new\nobjects.  The generated IDs tend to be sequential so that objects that\nare likely related in some way get loaded together.\n\nBTreeFolder2 implements the full Folder interface, with the exception\nthat the superValues() method does not return any items.  To implement\nthe method in the way the Zope codebase expects would undermine the\nperformance benefits gained by using BTreeFolder2.\n\nChangelog\n=========\n\n5.0 (2023-02-01)\n----------------\n\n- Drop support for Python 2.7, 3.5, 3.6.\n\n\n4.4 (2022-12-16)\n----------------\n\n- Fix Python 2 incompatibility.\n\n- Fix insidious buildout configuration bug for tests against Zope 4.\n\n- Add support for Python 3.10 and 3.11.\n\n\n4.3 (2021-04-26)\n----------------\n\n- Add support for Python 3.9\n\n- Modernize the ZMI template to match the Zope 4 styles\n  (`#10 <https://github.com/zopefoundation/Products.BTreeFolder2/issues/10>`_)\n\n- Add ``Delete All Objects`` button to the manage screen.\n  (`#9 <https://github.com/zopefoundation/Products.BTreeFolder2/issues/9>`_)\n\n\n4.2 (2019-03-08)\n----------------\n\n- Specify supported Python versions using ``python_requires`` in setup.py\n  (`Zope#481 <https://github.com/zopefoundation/Zope/issues/481>`_)\n\n- Drop support for Python 3.4 since Zope itself does not support it.\n\n- Add support for Python 3.8\n\n\n4.1 (2018-10-05)\n----------------\n\n- More PEP8 compliance.\n\n- Add icon for Bootstrap ZMI.\n\n- Avoid deprecation warnings by using current API.\n\n- Add support for Python 3.7.\n\n\n4.0.0 (2017-05-23)\n------------------\n\n- added tox configuration\n\n- Python 3 compatibility\n\n- Update to require and be compatible with Zope 4.\n\n3.0 (2016-07-18)\n----------------\n\n- Update Dependencies (no ZODB, but BTrees)\n\n2.14.0 (2015-06-18)\n-------------------\n\n- Require ExtensionClass >= 4.1a1 (Compatible w/ Zope 4).\n\n2.13.5 (2015-06-18)\n-------------------\n\n- Added case for clean-up routine where the meta type index contains\n  keys that are not in the tree.\n\n2.13.4 (2011-12-12)\n-------------------\n\n- Provide security declaration for `BTreeFolder2Base.hasObject` method.\n\n- Add some tests for correct `getattr` behavior.\n\n- Minor `__getattr__` and `_getOb` optimizations.\n\n2.13.3 (2011-03-15)\n-------------------\n\n- `keys`, `values` and `items` methods are now exactly the same as\n  `objectIds`, `objectValues` and `objectItems`. They did the same before\n  already but duplicated the code.\n\n2.13.2 (2011-03-08)\n-------------------\n\n- `objectValues` and `objectItems` no longer do a special handling when no\n  special `spec` is requested as `objectIds` already does the correct\n  handling.\n\n2.13.1 (2010-08-04)\n-------------------\n\n- Make sure that methods returning objects return them Acquisition wrapped.\n\n- Be more careful in calling our own keys, values and items methods, as\n  sub-classes might have overridden some of them.\n\n2.13.0 (2010-07-11)\n-------------------\n\n- Changed the `objectIds`, `objectItems` and `objectValues` methods to use the\n  internal OOBTree methods directly if no `spec` argument is passed.\n\n- Change implementation of `keys`, `items` and `values` method to access the\n  `self._tree` OOBTree methods directly. This avoids lookups in the meta_types\n  structures.\n\n- Implement the full dictionary protocol including `__getitem__`,\n  `__delitem__`, `__setitem__`, `__nonzero__`, `__iter__` and `__contains__`.\n\n- Released as separate package.\n",
    "bugtrack_url": null,
    "license": "ZPL 2.1",
    "summary": "A BTree based implementation for Zope's OFS.",
    "version": "5.0",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6a99d3d307034f95326b707f0bceb0c2a3fe30def15890e71d62a1a5d288c9aa",
                "md5": "327b3956b8716d066ecde2aa090bb6a7",
                "sha256": "34679eff2df4df222e960f9514766f9903309ceca36f40f92e5c84363203f677"
            },
            "downloads": -1,
            "filename": "Products.BTreeFolder2-5.0-py3-none-any.whl",
            "has_sig": true,
            "md5_digest": "327b3956b8716d066ecde2aa090bb6a7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 17701,
            "upload_time": "2023-02-01T08:59:20",
            "upload_time_iso_8601": "2023-02-01T08:59:20.938979Z",
            "url": "https://files.pythonhosted.org/packages/6a/99/d3d307034f95326b707f0bceb0c2a3fe30def15890e71d62a1a5d288c9aa/Products.BTreeFolder2-5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "154c15e48b79fdef3337e8fd2a453ad9a056b0c8c33317ff5d8d7abef5466c94",
                "md5": "0f977a6c844860ff21487133064438f8",
                "sha256": "d15a2a6c9c437d6988a0fd74696a619dd03b8e0a9837da2c2791d7cd976fa74d"
            },
            "downloads": -1,
            "filename": "Products.BTreeFolder2-5.0.tar.gz",
            "has_sig": true,
            "md5_digest": "0f977a6c844860ff21487133064438f8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 19483,
            "upload_time": "2023-02-01T08:59:22",
            "upload_time_iso_8601": "2023-02-01T08:59:22.985658Z",
            "url": "https://files.pythonhosted.org/packages/15/4c/15e48b79fdef3337e8fd2a453ad9a056b0c8c33317ff5d8d7abef5466c94/Products.BTreeFolder2-5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-01 08:59:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "zopefoundation",
    "github_project": "Products.BTreeFolder2",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "products.btreefolder2"
}
        
Elapsed time: 0.04808s