remove padding when using ContentListing interface (#4610)

This commit is contained in:
Frédéric Péters 2014-04-01 17:44:05 +02:00
parent e753b90928
commit 5e01f77742
1 changed files with 9 additions and 0 deletions

View File

@ -27,6 +27,7 @@ from plone.z3cform.layout import wrap_form
import plone.app.querystring.querybuilder
from plone.app.querystring.interfaces import IQuerystringRegistryReader
from plone.registry.interfaces import IRegistry
+from plone.app.contentlisting.contentlisting import ContentListing
from pfwbged.collection import _
@ -389,6 +390,14 @@ class ContentListingView(BrowserView):
class QueryBuilder(plone.app.querystring.querybuilder.QueryBuilder):
def _makequery(self, *args, **kwargs):
results = plone.app.querystring.querybuilder.QueryBuilder._makequery(self, *args, **kwargs)
if isinstance(results, ContentListing):
# results may have been padded with None, but ContentListing
# doesn't like that.
results._basesequence = [x for x in results._basesequence if x is not None]
return results
def html_results(self, query):
"""html results, used for in the edit screen of a collection,
used in the live update results"""