Skip to content

Commit

Permalink
better documentation of new feature
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Feb 8, 2019
1 parent 7608888 commit 6d223a2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Breaking changes:

New features:

- addresses #4, allows third party software to define which indexes are used.
- Adresses `Still uses BTrees wrongly, screws up people changing Interfaces <https://github.com/zopefoundation/z3c.relationfield/issues/4>`_, allows third party software to define which indexes are used.
[jensens]

Bug fixes:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def read(*rnames):

setup(
name='z3c.relationfield',
version='0.7.2.dev0',
version='0.8.0.dev0',
description="A relation field framework for Zope 3.",
long_description=long_description,
classifiers=[
Expand Down
9 changes: 9 additions & 0 deletions src/z3c/relationfield/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -874,3 +874,12 @@ It's pointing to the nonexistent path:
>>> root['e'].rel.to_path
'nonexistent'
Setting up a releation catalog
==============================

This package provides a RelationCatalog initialized with a set of indexes commonly useful for queries on RelationValue objects.
The default indexes are `from_id`, `to_id`, `from_attribute`, `from_interfaces_flattened` and `to_interfaces_flattened`.

However, sometimes it is needed to define custom indexes.
The `zc.relationfield.index.RelationCatalog` class can be initialized with a list of dicts with keys `name` and `kwargs` to be passed to RelationCatalog to be passed to the catalogs `addValueIndex` method.
4 changes: 2 additions & 2 deletions src/z3c/relationfield/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def load(token, catalog, cache):
class RelationCatalog(Catalog):

def __init__(self, indexes=DEFAULT_INDEXES):
"""initialize the catalog with indexes.with
"""Initialize the catalog with indexes.
Uses defaults if not special configuration was passed.was
Uses defaults if not special configuration was passed.
"""
Catalog.__init__(self, dump, load)
for index in indexes:
Expand Down

0 comments on commit 6d223a2

Please sign in to comment.