-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetuphandlers.py
61 lines (49 loc) · 1.99 KB
/
setuphandlers.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# -*- coding: utf-8 -*-
#
# File: setuphandlers.py
#
# Copyright (c) 2012 by unknown <unknown>
# Generator: ArchGenXML Version 2.6
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
__author__ = """unknown <unknown>"""
__docformat__ = 'plaintext'
import logging
logger = logging.getLogger('PloneSchooltimeShows: setuphandlers')
from Products.PloneSchooltimeShows.config import PROJECTNAME
from Products.PloneSchooltimeShows.config import DEPENDENCIES
import os
from Products.CMFCore.utils import getToolByName
import transaction
##code-section HEAD
##/code-section HEAD
def isNotPloneSchooltimeShowsProfile(context):
return context.readDataFile("PloneSchooltimeShows_marker.txt") is None
def setupHideMetaTypesFromNavigations(context):
"""hide selected classes in the search form"""
if isNotPloneSchooltimeShowsProfile(context): return
# XXX use https://svn.plone.org/svn/collective/DIYPloneStyle/trunk/profiles/default/properties.xml
site = context.getSite()
portalProperties = getToolByName(site, 'portal_properties')
navtreeProperties = getattr(portalProperties, 'navtree_properties')
for klass in ['Season', 'Now_Playing_Page']:
propertyid = 'metaTypesNotToList'
lines = list(navtreeProperties.getProperty(propertyid) or [])
if klass not in lines:
lines.append(klass)
navtreeProperties.manage_changeProperties(**{propertyid: lines})
def updateRoleMappings(context):
"""after workflow changed update the roles mapping. this is like pressing
the button 'Update Security Setting' and portal_workflow"""
if isNotPloneSchooltimeShowsProfile(context): return
wft = getToolByName(context.getSite(), 'portal_workflow')
wft.updateRoleMappings()
def postInstall(context):
"""Called as at the end of the setup process. """
# the right place for your custom code
if isNotPloneSchooltimeShowsProfile(context): return
site = context.getSite()
##code-section FOOT
##/code-section FOOT