summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamie Lentin <jm@lentin.co.uk>2013-06-29 20:18:58 (GMT)
committerJamie Lentin <jm@lentin.co.uk>2013-06-29 20:18:58 (GMT)
commite8d7f0bc349bbfed788b43f3594db49a28bc8c14 (patch)
tree059209dbea1e2593be6065c334d2c3b998aed6c4
parentf6d79e8b94abc5baac2f46e4b92d2f2b9716d9ad (diff)
parent09c55a41b25a6affbfc510c926091a58aa45718d (diff)
downloadplone.formwidget.contenttree-e8d7f0bc349bbfed788b43f3594db49a28bc8c14.zip
plone.formwidget.contenttree-e8d7f0bc349bbfed788b43f3594db49a28bc8c14.tar.gz
plone.formwidget.contenttree-e8d7f0bc349bbfed788b43f3594db49a28bc8c14.tar.bz2
Merge pull request #12 from lentinj/master
Add some default binder instances with no filters
-rw-r--r--README.txt22
-rw-r--r--docs/HISTORY.txt4
-rw-r--r--plone/formwidget/contenttree/__init__.py5
3 files changed, 30 insertions, 1 deletions
diff --git a/README.txt b/README.txt
index a39e2f0..ea89f18 100644
--- a/README.txt
+++ b/README.txt
@@ -10,7 +10,27 @@ Choice fields, and a multi-select one (AutocompleteMultiSelectionFieldWidget)
for collection fields (e.g. List, Tuple) with a value_type of Choice.
When using this widget, the vocabulary/source has to provide the IQuerySource
-interface from z3c.formwidget.query and have a search() method.
+interface from z3c.formwidget.query and have a search() method. The easiest
+way to do this is generate one with one of:
+
+* plone.formwidget.contenttree.PathSourceBinder(navigation_tree_query=None, **kw)
+* plone.formwidget.contenttree.ObjPathSourceBinder(navigation_tree_query=None, **kw)
+* plone.formwidget.contenttree.UUIDSourceBinder(navigation_tree_query=None, **kw)
+
+Where ``navigation_tree_query`` is some restrictions that should be applied to
+any Catalog query. The rest of the arguments are used to form a filter (see source.py).
+
+``PathSourceBinder`` and ``ObjPathSourceBinder`` store the selected object's
+path in the field value. This means that the link will be broken if the object
+is moved. ``UUIDSourceBinder`` stores UUID references, so will handle pages
+being moved.
+
+If you do not want to filter the content tree whatsoever, there are some
+pre-baked instances too:
+
+* plone.formwidget.contenttree.path_src_binder
+* plone.formwidget.contenttree.obj_path_src_binder
+* plone.formwidget.contenttree.uuid_src_binder
Example Usage::
diff --git a/docs/HISTORY.txt b/docs/HISTORY.txt
index 4dabcc1..2257dc7 100644
--- a/docs/HISTORY.txt
+++ b/docs/HISTORY.txt
@@ -4,6 +4,10 @@ Changelog
1.0.7 (unreleased)
------------------
+* Add in some default binder instances, mostly for use with supermodel XML
+ schemas.
+ [lentinj]
+
* Switch to ``plone.app.testing``
[saily]
diff --git a/plone/formwidget/contenttree/__init__.py b/plone/formwidget/contenttree/__init__.py
index 501f596..3dd02f1 100644
--- a/plone/formwidget/contenttree/__init__.py
+++ b/plone/formwidget/contenttree/__init__.py
@@ -6,3 +6,8 @@ from plone.formwidget.contenttree.widget import MultiContentTreeFieldWidget
from plone.formwidget.contenttree.source import PathSourceBinder,\
ObjPathSourceBinder, UUIDSourceBinder
+
+# Some binder instances for use with plone.supermodel schemas
+path_src_binder = PathSourceBinder()
+obj_path_src_binder = ObjPathSourceBinder()
+uuid_src_binder = UUIDSourceBinder()