2 bricoles.
[Plinn.git] / patch.py
1 """ Plinn monkey patch
2
3
4
5 """
6 from AccessControl import ClassSecurityInfo
7 from Products.CMFCore.permissions import ListFolderContents, View, ViewManagementScreens,\
8 ManageProperties, AddPortalFolders, AddPortalContent,\
9 ManagePortal, ModifyPortalContent
10
11 from Products.CMFCore.PortalFolder import PortalFolder as CMFPortalFolder
12 from Folder import PlinnFolder
13
14 cmfPortalFolderSecurity = ClassSecurityInfo()
15
16 cmfPortalFolderSecurity.declareProtected(ListFolderContents, 'listFolderContents')
17 CMFPortalFolder.listFolderContents = PlinnFolder.listFolderContents.im_func
18
19 cmfPortalFolderSecurity.declareProtected(ListFolderContents, 'listNearestFolderContents')
20 CMFPortalFolder.listNearestFolderContents = PlinnFolder.listNearestFolderContents.im_func
21
22 cmfPortalFolderSecurity.declareProtected(ListFolderContents, 'listCatalogedContents')
23 CMFPortalFolder.listCatalogedContents = PlinnFolder.listCatalogedContents.im_func
24
25 cmfPortalFolderSecurity.declareProtected(AddPortalContent, 'put_upload')
26 CMFPortalFolder.put_upload = PlinnFolder.put_upload.im_func
27
28 cmfPortalFolderSecurity.apply(CMFPortalFolder)
29
30
31 from Products.CMFDefault.formlib.form import _EditFormMixin
32 from patch_impl import _setRedirect
33 _EditFormMixin._setRedirect = _setRedirect