collective/eea.facetednavigation — pull request #10 by do3cc (2013-11-28 13:46:06+00:00)
Title: feat(dx): conditionally query by unicode value

Keyword indexes get their values stored as unicode strings if the objects to be indexed are dexterity type objects. Finally!
AT stores its values as encoded strings. This leads to problematic coexistence (http://stackoverflow.com/a/6152209/39345), but don't tell that one of our sites, it might get nervous.

Anyway. Because it is dangerous to mix AT and DX types, this code assumes that if plone.app.contenttypes is available, the site is a DX only site. If people think they can mix and match AT and DX, they have to monkey patch anyway.

Since DX will be the standard type in the future, the changes are written in such a way that it is easily possible to identify AT compatibility code and remove AT compatibility code somewhere in the far future easily.

The slightly weird method definition in dexterity_support ensures that the check for dexterity has only to be done once during import time.

There is a slight change in behavior in widget.py
formerly, there was a catchall exception, (except Exception: will catch ConflictErrors!)
Which would pass on the value unchanged. This does not happen any longer.
If a value cannot be encoded from unicode to an utf-8 encoded string, bad things are happening.