Index: quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/collection.py
===================================================================
--- quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/collection.py	(revision 3554)
+++ quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/collection.py	(revision 3555)
@@ -1,8 +1,4 @@
-import random
+from zope.interface import implements
 
-from zope.interface import implements
-from zope.component import getMultiAdapter
-
-from plone.portlets.interfaces import IPortletDataProvider
 from plone.portlet.collection import collection as base
 
@@ -10,20 +6,14 @@
 from zope.formlib import form
 
-from plone.memoize.instance import memoize
-from plone.memoize import ram
-from plone.memoize.compress import xhtml_compress
-
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
-from plone.app.vocabularies.catalog import SearchableTextSourceBinder
 from zope.schema import ValidationError
 from plone.app.form.widgets.uberselectionwidget import UberSelectionWidget
 
-from Products.ATContentTypes.interface import IATTopic
-from Products.CMFPlone.PloneBatch import Batch
 from plone.portlet.collection.collection import ICollectionPortlet
 
 from quintagroup.portlet.collection import MessageFactory as _
 
-MIN_BATCH_SIZE , MAX_BATCHSIZE = 1, 30
+MIN_BATCH_SIZE, MAX_BATCHSIZE = 1, 30
+
 
 class NotValidBatchSizeValue(ValidationError):
@@ -32,8 +22,10 @@
     """
 
+
 def validate_batch_size(value):
     if MIN_BATCH_SIZE <= value <= MAX_BATCHSIZE:
         return True
     raise NotValidBatchSizeValue(value)
+
 
 class IQCollectionPortlet(ICollectionPortlet):
@@ -42,39 +34,52 @@
     """
 
-    item_attributes = schema.List(title=_(u"Attributes to display"),
-                                  description=_(u"description_attributes", default=u"Select attributes to show for collection item."),
-                                  required=False,
-                                  default=[u"Title", u"Description"],
-                                  value_type=schema.Choice(vocabulary='quintagroup.portlet.collection.vocabularies.PortletAttributesVocabulary'))
+    item_attributes = schema.List(
+        title=_(u"Attributes to display"),
+        description=_(u"description_attributes",
+                      default=u"Select attributes to show for collection "
+                      "item."),
+        required=False,
+        default=[u"Title", u"Description"],
+        value_type=schema.Choice(vocabulary='quintagroup.portlet.collection.\
+                vocabularies.PortletAttributesVocabulary'))
 
-    styling = schema.Choice(title=_(u"Portlet style"),
-                            description=_(u"description_styling", default=u"Choose a css style for the porlet."),
-                            required=False,
-                            default=u"",
-                            vocabulary='quintagroup.portlet.collection.vocabularies.PortletCSSVocabulary')
+    styling = schema.Choice(
+        title=_(u"Portlet style"),
+        description=_(u"description_styling",
+                      default=u"Choose a css style for the porlet."),
+        required=False,
+        default=u"",
+        vocabulary='quintagroup.portlet.collection.\
+                vocabularies.PortletCSSVocabulary')
 
+    show_item_more = schema.Bool(
+        title=_(u"Show more... link for collection items"),
+        description=_(u"If enabled, a more... link will appear in the bottom "
+                      "of the each collection item, linking to the "
+                      "corresponding item."),
+        required=True,
+        default=True)
 
-    show_item_more = schema.Bool(title=_(u"Show more... link for collection items"),
-                                 description=_(u"If enabled, a more... link will appear in the bottom of the each collection item, "
-                                                "linking to the corresponding item."),
-                                 required=True,
-                                 default=True)
+    link_title = schema.Bool(
+        title=_(u"Link title"),
+        description=_(u"If enabled, title will be shown as link to "
+                      "corresponding object."),
+        required=True,
+        default=True)
 
-    link_title = schema.Bool(title=_(u"Link title"),
-                                 description=_(u"If enabled, title will be shown as link to corresponding object. "),
-                                 required=True,
-                                 default=True)
+    allow_batching = schema.Bool(
+        title=_(u"Allow batching"),
+        description=_(u"If enabled, items will be split into pages."),
+        required=False,
+        default=False)
 
-    allow_batching = schema.Bool(title=_(u"Allow batching"),
-                                 description=_(u"If enabled, items will be split into pages."),
-                                 required=False,
-                                 default=False)
+    batch_size = schema.Int(
+        title=_(u"Batch size"),
+        description=_("Amount of items per page (if not set 3 items will be "
+                      "displayed as default)."),
+        required=False,
+        default=3,
+        constraint=validate_batch_size)
 
-    batch_size = schema.Int(title=_(u"Batch size"),
-                            description=_("Amount of items per page"
-                                          "(if not set 3 items will be displayed as default)."),
-                            required=False,
-                            default=3,
-                            constraint=validate_batch_size)
 
 class Assignment(base.Assignment):
@@ -97,7 +102,8 @@
                  link_title=True, allow_batching=False, batch_size=3):
 
-        super(Assignment, self).__init__(header=header,
-            target_collection=target_collection, limit=limit,
-            random=random, show_more=show_more, show_dates=show_dates)
+        super(Assignment, self).__init__(header=header, random=random,
+                                         target_collection=target_collection,
+                                         limit=limit, show_more=show_more,
+                                         show_dates=show_dates)
 
         if len(item_attributes) > 0:
@@ -115,4 +121,5 @@
         """
         return self.header
+
 
 class Renderer(base.Renderer):
@@ -146,4 +153,5 @@
         return self.items_listing(portlet_items=self.results())
 
+
 class AddForm(base.AddForm):
     """Portlet add form.
@@ -158,8 +166,10 @@
 
     label = _(u"Add Collection Portlet")
-    description = _(u"This portlet display a listing of items from a Collection.")
+    description = _(
+        u"This portlet display a listing of items from a Collection.")
 
     def create(self, data):
         return Assignment(**data)
+
 
 class EditForm(base.EditForm):
@@ -174,3 +184,4 @@
 
     label = _(u"Edit Collection Portlet")
-    description = _(u"This portlet display a listing of items from a Collection.")
+    description = _(
+        u"This portlet display a listing of items from a Collection.")
Index: quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/tests/test_portlet.py
===================================================================
--- quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/tests/test_portlet.py	(revision 3554)
+++ quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/tests/test_portlet.py	(revision 3555)
@@ -16,4 +16,5 @@
 from Products.CMFCore.utils import getToolByName
 
+
 class TestQPortletCollection(TestCase):
     def afterSetUp(self):
@@ -21,6 +22,8 @@
 
     def testPortletTypeRegistered(self):
-        portlet = getUtility(IPortletType, name='quintagroup.portlet.collection.Collection')
-        self.assertEquals(portlet.addview, 'quintagroup.portlet.collection.Collection')
+        portlet = getUtility(
+            IPortletType, name='quintagroup.portlet.collection.Collection')
+        self.assertEquals(
+            portlet.addview, 'quintagroup.portlet.collection.Collection')
 
     def testInterfaces(self):
@@ -30,11 +33,13 @@
 
     def testInvokeAddview(self):
-        portlet = getUtility(IPortletType, name='quintagroup.portlet.collection.Collection')
-        mapping = self.portal.restrictedTraverse('++contextportlets++plone.leftcolumn')
+        portlet = getUtility(
+            IPortletType, name='quintagroup.portlet.collection.Collection')
+        mapping = self.portal.restrictedTraverse(
+            '++contextportlets++plone.leftcolumn')
         for m in mapping.keys():
             del mapping[m]
         addview = mapping.restrictedTraverse('+/' + portlet.addview)
 
-        addview.createAndAdd(data={'header' : u"test title"})
+        addview.createAndAdd(data={'header': u"test title"})
 
         self.assertEquals(len(mapping), 1)
@@ -53,9 +58,12 @@
         request = self.folder.REQUEST
         view = self.folder.restrictedTraverse('@@plone')
-        manager = getUtility(IPortletManager, name='plone.rightcolumn', context=self.portal)
+        manager = getUtility(
+            IPortletManager, name='plone.rightcolumn', context=self.portal)
         assignment = collection.Assignment(header=u"title")
 
-        renderer = getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer)
+        renderer = getMultiAdapter(
+            (context, request, view, manager, assignment), IPortletRenderer)
         self.failUnless(isinstance(renderer, collection.Renderer))
+
 
 class TestQPortletCollectionRenderer(TestCase):
@@ -64,15 +72,19 @@
         self.setRoles(('Manager',))
         self.pages = self._createType(self.folder, 'Topic', 'pages')
-        crit = self.folder.pages.addCriterion('portal_type', 'ATSimpleStringCriterion')
+        crit = self.folder.pages.addCriterion(
+            'portal_type', 'ATSimpleStringCriterion')
         crit.setValue('Document')
 
-    def renderer(self, context=None, request=None, view=None, manager=None, assignment=None):
+    def renderer(self, context=None, request=None, view=None, manager=None,
+                 assignment=None):
         context = context or self.folder
         request = request or self.folder.REQUEST
         view = view or self.folder.restrictedTraverse('@@plone')
-        manager = manager or getUtility(IPortletManager, name='plone.rightcolumn', context=self.portal)
+        manager = manager or getUtility(
+            IPortletManager, name='plone.rightcolumn', context=self.portal)
         assignment = assignment or collection.Assignment(header=u"title")
 
-        return getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer)
+        return getMultiAdapter((context, request, view, manager, assignment),
+                               IPortletRenderer)
 
     def _createType(self, context, portal_type, id, **kwargs):
@@ -92,14 +104,16 @@
         Cover problem in #9184
         """
-        r = self.renderer(context=self.portal,
-                          assignment=collection.Assignment(header=u"title",
-                                                           target_collection=u"/events"))
-        r  = r.__of__(self.folder)
+        r = self.renderer(
+            context=self.portal,
+            assignment=collection.Assignment(header=u"title",
+                                             target_collection=u"/events"))
+        r = r.__of__(self.folder)
         self.assertEqual(r.collection().id, 'events')
 
     def test_portletStyle(self):
         renderer = self.renderer(context=self.portal,
-                                 assignment=collection.Assignment(header=u"title",
-                                                                  styling="TestClass"))
+                                 assignment=collection.Assignment(
+                                     header=u"title",
+                                     styling="TestClass"))
         renderer = renderer.__of__(self.folder)
         renderer.update()
@@ -110,12 +124,15 @@
         page = self._createType(self.folder, 'Document', 'page')
         page.update(title="Test Page", description="Test description")
+        target_collection = '/Members/test_user_1_/pages'
         renderer = self.renderer(context=self.portal,
-                                 assignment=collection.Assignment(header=u"title",
-                                                                  item_attributes=[u'Title'],
-                                                                  target_collection='/Members/test_user_1_/pages'))
+                                 assignment=collection.Assignment(
+                                     header=u"title",
+                                     item_attributes=[u'Title'],
+                                     target_collection=target_collection))
         renderer = renderer.__of__(self.folder)
         renderer.update()
         self.failUnless('Test Page' in renderer.render())
         self.failUnless('Test description' not in renderer.render())
+
 
 class TestQPortletCollectionQuery(TestCase):
@@ -138,22 +155,25 @@
         return obj
 
-
-    def renderer(self, context=None, request=None, view=None, manager=None, assignment=None):
+    def renderer(self, context=None, request=None, view=None, manager=None,
+                 assignment=None):
         context = context or self.folder
         request = request or self.folder.REQUEST
         view = view or self.folder.restrictedTraverse('@@plone')
-        manager = manager or getUtility(IPortletManager, name='plone.leftcolumn', context=self.portal)
+        manager = manager or getUtility(
+            IPortletManager, name='plone.leftcolumn', context=self.portal)
         assignment = assignment
-        return getMultiAdapter((context, request, view, manager, assignment), IPortletRenderer)
+        return getMultiAdapter((context, request, view, manager, assignment),
+                               IPortletRenderer)
 
     def testSimpleQuery(self):
         # set up our collection to search for Folders
-        crit = self.folder.collection.addCriterion('portal_type', 'ATSimpleStringCriterion')
+        crit = self.folder.collection.addCriterion(
+            'portal_type', 'ATSimpleStringCriterion')
         crit.setValue('Folder')
 
         # add a few folders
         for i in range(6):
-            self.folder.invokeFactory('Folder', 'folder_%s'%i)
-            getattr(self.folder, 'folder_%s'%i).reindexObject()
+            self.folder.invokeFactory('Folder', 'folder_%s' % i)
+            getattr(self.folder, 'folder_%s' % i).reindexObject()
 
         # the folders are returned by the topic
@@ -163,10 +183,14 @@
 
         mapping = PortletAssignmentMapping()
-        request = self.folder.REQUEST
-        mapping['foo'] = collection.Assignment(header=u"title", target_collection='/Members/test_user_1_/collection')
-        collectionrenderer = self.renderer(context=None, request=None, view=None, manager=None, assignment=mapping['foo'])
+        t_collection = '/Members/test_user_1_/collection'
+        mapping['foo'] = collection.Assignment(header=u"title",
+                                               target_collection=t_collection)
+        collectionrenderer = self.renderer(context=None, request=None,
+                                           view=None, manager=None,
+                                           assignment=mapping['foo'])
 
         # we want the portlet to return us the same results as the collection
-        self.assertEquals(collection_num_items, len(collectionrenderer.results()))
+        self.assertEquals(
+            collection_num_items, len(collectionrenderer.results()))
 
     def testRandomQuery(self):
@@ -185,14 +209,16 @@
         # set up our portlet renderer
         mapping = PortletAssignmentMapping()
-        request = self.folder.REQUEST
+        t_collection = '/Members/test_user_1_/collection'
         mapping['foo'] = collection.Assignment(header=u"title",
                                                random=True,
-                                               target_collection='/Members/test_user_1_/collection')
-        collectionrenderer = self.renderer(context=None, request=None, view=None, manager=None, assignment=mapping['foo'])
+                                               target_collection=t_collection)
+        collectionrenderer = self.renderer(context=None, request=None,
+                                           view=None, manager=None,
+                                           assignment=mapping['foo'])
 
         # add some folders
         for i in range(6):
-            self.folder.invokeFactory('Folder', 'folder_%s'%i)
-            getattr(self.folder, 'folder_%s'%i).reindexObject()
+            self.folder.invokeFactory('Folder', 'folder_%s' % i)
+            getattr(self.folder, 'folder_%s' % i).reindexObject()
 
         # collection with no criteria -- should return empty list, without error
@@ -204,4 +230,5 @@
         global collection_was_called
         collection_was_called = False
+
         def mark_collection_called(**kw):
             global collection_was_called
@@ -214,5 +241,6 @@
 
         # collection with simple criterion -- should return 1 (random) folder
-        crit = self.folder.collection.addCriterion('portal_type', 'ATSimpleStringCriterion')
+        crit = self.folder.collection.addCriterion(
+            'portal_type', 'ATSimpleStringCriterion')
         crit.setValue('Folder')
         self.assertEqual(len(collectionrenderer.results()), 1)
@@ -220,5 +248,6 @@
 
         # collection with multiple criteria -- should behave similarly
-        crit = self.folder.collection.addCriterion('Creator', 'ATSimpleStringCriterion')
+        crit = self.folder.collection.addCriterion(
+            'Creator', 'ATSimpleStringCriterion')
         crit.setValue('test_user_1_')
         collectionrenderer.results()
Index: quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/utils.py
===================================================================
--- quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/utils.py	(revision 3554)
+++ quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/utils.py	(revision 3555)
@@ -1,4 +1,5 @@
 """Somme utility functions for common use"""
 from Products.CMFCore.utils import getToolByName
+
 
 def getStylesVocabulary(context):
@@ -13,5 +14,5 @@
                 value_list = []
                 for line in dropdown_list:
-                    values = filter(lambda x:x.strip(), line.split('|', 1))
+                    values = filter(lambda x: x.strip(), line.split('|', 1))
                     if len(values) == 0:
                         continue
Index: quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/vocabularies.py
===================================================================
--- quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/vocabularies.py	(revision 3554)
+++ quintagroup.portlet.collection/trunk/quintagroup/portlet/collection/vocabularies.py	(revision 3555)
@@ -1,4 +1,5 @@
 try:
-    from zope.schema.interfaces import IVocabularyFactory
+    from zope.schema import interfaces
+    IVocabularyFactory = interfaces.IVocabularyFactory
 except ImportError:
     from zope.app.schema.vocabulary import IVocabularyFactory
@@ -12,16 +13,16 @@
 
 PORTLET_CSS_STYLES = (
-     (u"class1", _(u"Class1")),
-     (u"class2", _(u"Class2")),
+    (u"class1", _(u"Class1")),
+    (u"class2", _(u"Class2")),
 )
 
 PORTLET_ATTRIBUTES_TO_SHOW = (
-     (u"Title", _(u"Title")),
-     (u"Description", _(u"Description")),
+    (u"Title", _(u"Title")),
+    (u"Description", _(u"Description")),
 )
+
 
 class PortletCSSVocabulary(object):
     implements(IVocabularyFactory)
-
 
     def __call__(self, context):
@@ -49,11 +50,12 @@
 PortletCSSVocabulary = PortletCSSVocabulary()
 
+
 class PortletAttributesVocabulary(object):
-     implements(IVocabularyFactory)
+    implements(IVocabularyFactory)
 
-     def __call__(self, context):
-         items = [SimpleTerm(value, value, title) for value, title in PORTLET_ATTRIBUTES_TO_SHOW]
-         return SimpleVocabulary(items)
+    def __call__(self, context):
+        items = [SimpleTerm(value, value, title) for value,
+                 title in PORTLET_ATTRIBUTES_TO_SHOW]
+        return SimpleVocabulary(items)
 
 PortletAttributesVocabulary = PortletAttributesVocabulary()
-
