EEA Faceted Inheritance
=======================
An extension to be used within eea.facetednavigation in order to allow objects
to inherit faceted configuration from another faceted navigable object. This way
one can define a global faceted navigable folder and reuse this configuration
for multiple heritors.

Imports
-------

    >>> from zope.component import queryMultiAdapter, getMultiAdapter
    >>> from eea.facetednavigation.interfaces import ICriteria
    >>> from eea.faceted.inheritance.interfaces import IHeritorAccessor

Set up
------

    >>> self.loginAsPortalOwner()

Create a faceted navigable folder
---------------------------------

    >>> fid = portal.invokeFactory('Folder', 'ancestor')
    >>> ancestor = portal._getOb(fid)
    >>> request = ancestor.REQUEST
    >>> subtyper = getMultiAdapter((ancestor, request), name=u'faceted_subtyper')
    >>> subtyper.enable()

  Cleanup default widgets

    >>> cids = ICriteria(ancestor).keys()
    >>> for cid in cids:
    ...     ICriteria(ancestor).delete(cid)
    >>> ICriteria(ancestor).keys()
    []

  Add a widget

    >>> _ = ICriteria(ancestor).add('text', 'left')

Create a faceted heritor folder
-------------------------------

    >>> fid = portal.invokeFactory('Folder', 'heritor')
    >>> heritor = portal._getOb(fid)
    >>> request = heritor.REQUEST
    >>> hertyper = getMultiAdapter((heritor, request), name=u'facetedheritor_subtyper')
    >>> hertyper.can_enable_heritor
    True

    >>> hertyper.enable()

  Connect heritor with ancestor

    >>> IHeritorAccessor(heritor).ancestor = '/plone/ancestor'
    >>> IHeritorAccessor(heritor).ancestor
    '/plone/ancestor'

  Now faceted configuration from ancestor is available also for heritor. Let's
  check that:

    >>> ICriteria(ancestor).keys()
    ['c0']

    >>> ICriteria(heritor).keys()
    ['c0']

  If something is changes on ancestor, changes will be visible on heritor, also:

    >>> _ = ICriteria(ancestor).add('select', 'right')
    >>> ICriteria(ancestor).keys()
    ['c0', 'c1']

    >>> ICriteria(heritor).keys()
    ['c0', 'c1']

    >>> criterion = ICriteria(ancestor).get('c0')
    >>> criterion
    <eea.facetednavigation.widgets.storage.Criterion object at ...>

    >>> h_criterion = ICriteria(heritor).get('c0')
    >>> h_criterion is criterion
    True
