Channels
========

Setup
-----

  >>> from zope import component
  >>> from zope.app.component.hooks import setSite
  >>> setSite(self.portal)

The portal tool
---------------

When installed in a Plone site, we will create a tool called
``portal_newsletters``, and therein a couple of containers:

  >>> sorted(self.portal['portal_newsletters'].objectIds())
  ['channels', 'collectors']

Give me a list of all channels
------------------------------

The ``channels`` folder contains the list of ``IChannel`` available.
These channels can be retrieved through the ``IChannelLookup``
utility, like so:

  >>> from collective.singing.interfaces import IChannelLookup
  >>> component.getUtility(IChannelLookup)()
  [<Channel at /plone/portal_newsletters/channels/default-channel>]

Let's create another channel and ask for the list of channels again:

  >>> from collective.dancing.channel import Channel
  >>> channels = self.portal['portal_newsletters']['channels']
  >>> channels['wq'] = Channel('wq')
  >>> component.getUtility(IChannelLookup)() # doctest: +NORMALIZE_WHITESPACE
  [<Channel at /plone/portal_newsletters/channels/default-channel>, 
   <Channel at /plone/portal_newsletters/channels/wq>]

