Marre de se faire chier avec des lubies de geeks…
[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 from utils import getCPInfo, popCP
14
15 cmfPortalFolderSecurity = ClassSecurityInfo()
16
17 cmfPortalFolderSecurity.declareProtected(ListFolderContents, 'listFolderContents')
18 CMFPortalFolder.listFolderContents = PlinnFolder.listFolderContents.im_func
19
20 cmfPortalFolderSecurity.declareProtected(ListFolderContents, 'listNearestFolderContents')
21 CMFPortalFolder.listNearestFolderContents = PlinnFolder.listNearestFolderContents.im_func
22
23 cmfPortalFolderSecurity.declareProtected(ListFolderContents, 'listCatalogedContents')
24 CMFPortalFolder.listCatalogedContents = PlinnFolder.listCatalogedContents.im_func
25
26 cmfPortalFolderSecurity.declareProtected(AddPortalContent, 'put_upload')
27 CMFPortalFolder.put_upload = PlinnFolder.put_upload.im_func
28
29 cmfPortalFolderSecurity.declarePublic('getCPInfo')
30 CMFPortalFolder.getCPInfo = getCPInfo
31
32 cmfPortalFolderSecurity.declarePublic('getCP')
33 CMFPortalFolder.popCP = popCP
34
35 cmfPortalFolderSecurity.apply(CMFPortalFolder)
36
37
38 from Products.CMFDefault.formlib.form import _EditFormMixin
39 from patch_impl import _setRedirect
40 _EditFormMixin._setRedirect = _setRedirect