Skip to content

Commit

Permalink
merge hotfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
vangheem committed Jan 29, 2014
1 parent f3cdefa commit a6a3e50
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 3 deletions.
21 changes: 21 additions & 0 deletions Products/CMFPlone/CatalogTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,27 @@ def searchResults(self, REQUEST=None, **kw):

__call__ = searchResults

def search(self, *args, **kw):
# Wrap search() the same way that searchResults() is
query = {}

if args:
query = args[0]
elif 'query_request' in kw:
query = kw.get['query_request']

kw['query_request'] = query.copy()

user = _getAuthenticatedUser(self)
query['allowedRolesAndUsers'] = self._listAllowedRolesAndUsers(user)

if not _checkPermission(AccessInactivePortalContent, self):
query['effectiveRange'] = DateTime()

kw['query_request'] = query

return super(CatalogTool, self).search(**kw)

security.declareProtected(ManageZCatalogEntries, 'clearFindAndRebuild')
def clearFindAndRebuild(self):
"""Empties catalog, then finds all contentish objects (i.e. objects
Expand Down
1 change: 1 addition & 0 deletions Products/CMFPlone/FactoryTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,7 @@ class FactoryTool(PloneBaseTool, UniqueObject, SimpleItem):
f = open(os.path.join(wwwpath, 'portal_factory_docs.stx'), 'r')
_docs = f.read()
f.close()
del f
_docs = stx2html(_docs)

security.declarePublic('docs')
Expand Down
13 changes: 10 additions & 3 deletions Products/CMFPlone/tests/testCatalogTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,10 +480,17 @@ def testSearchIgnoreAccents(self):
self.assertEqual(len(self.catalog(SearchableText='Économétrie')), 3)
self.assertEqual(len(self.catalog(SearchableText='Econométrie')), 3)
self.assertEqual(len(self.catalog(SearchableText='ECONOMETRIE')), 3)




def testSearchIsProtected(self):
self.login()
self.folder.invokeFactory("Document", "sekretz")
self.logout()
catalog = self.portal.portal_catalog
bogus = catalog.search({'portal_type': 'Document'})
real = catalog.portal_catalog.searchResults(portal_type='Document')
self.assertEqual(len(bogus), len(real))


class TestCatalogSorting(PloneTestCase.PloneTestCase):

def afterSetUp(self):
Expand Down
8 changes: 8 additions & 0 deletions Products/CMFPlone/tests/testPortalFactory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import urlparse
import os
from Products.CMFPlone.tests import PloneTestCase

from Products.CMFCore.permissions import AddPortalContent
Expand Down Expand Up @@ -352,3 +353,10 @@ def testBrowserResource(self):
path = "%s/++resource++plone-logo.png" % self.tmp_obj_path
data = self.publish(path)
self.assertEqual(data.getHeader('Content-Type'), 'image/png')

def testFactoryToolDocsFileNotPublishable(self):
import Products.CMFPlone
res = self.publish('/plone/portal_factory/f')
plone_code = os.path.dirname(Products.CMFPlone.__file__)

self.assertNotIn(plone_code, res.getBody())
3 changes: 3 additions & 0 deletions docs/CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Changelog
4.3.3 (unreleased)
------------------

- merge hotfixes from https://pypi.python.org/pypi/Products.PloneHotfix20131210
[vangheem]

- handle plone.app.textfield RichTextValue objects in syndication. Should
fix syndication with plone.app.contenttypes.
[vangheem]
Expand Down

0 comments on commit a6a3e50

Please sign in to comment.