From dd1fa6c1eb79e72724dcd7b00c60f16d3a5d7d0b Mon Sep 17 00:00:00 2001 From: optilude Date: Mon, 23 Mar 2009 09:39:47 +0000 Subject: [PATCH] Make note about unicode hacks git-svn-id: http://svn.plone.org/svn/plone/plone.principalsource/trunk@26103 3b4cdb85-528f-c531-b63d-5919d5b1aa08 --- README.txt | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.txt b/README.txt index d470731..4a70dfe 100644 --- a/README.txt +++ b/README.txt @@ -18,4 +18,19 @@ They are registered as named vocabularies, so you can do:: The underlying source (see source.py) implements the IQuerySource interface from z3c.formwidget.query. This means that it can be used for a query-select -widget, including the one in plone.formwidget.autocomplete. \ No newline at end of file +widget, including the one in plone.formwidget.autocomplete. + +A note about unicode +-------------------- + +The source attempts to make it safe to do a __contains__ check, a getTerm() +lookup, and searches using unicode strings. This is somewhat constrained by +the underlying plugins. In particular, the standard ZODBGroups plugin is +incapable of searching for groups with unicode titles or ids, and returns +a list of *all* groups if passed a unicode string. As such, the source +forces all unicode strings used to search for groups to UTF-8 (searching for +users is unaffected). + +Also, remember that tokens should be 7-bit ASCII strings. getTermByToken() is +forgiving in that it silently encodes a unicode string to utf-8, but really +you should only pass unicode to this method. \ No newline at end of file