-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
98 lines (80 loc) · 3.36 KB
/
__init__.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# -*- coding: utf-8 -*-
#
# File: PloneRDA.py
#
# Copyright (c) 2008 by (c) CENDITEL
# Generator: ArchGenXML Version 2.1
# http://plone.org/products/archgenxml
#
# GNU General Public License (GPL)
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
#
__author__ = """Leonardo J. Caballero G. <[email protected]>, Ruben Rangel
<[email protected]>, Maria A. Espinoza <[email protected]>"""
__docformat__ = 'plaintext'
# There are three ways to inject custom code here:
#
# - To set global configuration variables, create a file AppConfig.py.
# This will be imported in config.py, which in turn is imported in
# each generated class and in this file.
# - To perform custom initialisation after types have been registered,
# use the protected code section at the bottom of initialize().
import logging
logger = logging.getLogger('PloneRDA')
logger.debug('Installing Product')
import os
import os.path
from Globals import package_home
import Products.CMFPlone.interfaces
from Products.Archetypes import listTypes
from Products.Archetypes.atapi import *
from Products.Archetypes.utils import capitalize
from Products.CMFCore import DirectoryView
from Products.CMFCore import permissions as cmfpermissions
from Products.CMFCore import utils as cmfutils
from Products.CMFPlone.utils import ToolInit
from config import *
DirectoryView.registerDirectory('skins', product_globals)
##code-section custom-init-head #fill in your manual code here
##/code-section custom-init-head
def initialize(context):
"""initialize product (called by zope)"""
##code-section custom-init-top #fill in your manual code here
##/code-section custom-init-top
# imports packages and types for registration
import content
# Initialize portal content
all_content_types, all_constructors, all_ftis = process_types(
listTypes(PROJECTNAME),
PROJECTNAME)
cmfutils.ContentInit(
PROJECTNAME + ' Content',
content_types = all_content_types,
permission = DEFAULT_ADD_CONTENT_PERMISSION,
extra_constructors = all_constructors,
fti = all_ftis,
).initialize(context)
# Give it some extra permissions to control them on a per class limit
for i in range(0,len(all_content_types)):
klassname=all_content_types[i].__name__
if not klassname in ADD_CONTENT_PERMISSIONS:
continue
context.registerClass(meta_type = all_ftis[i]['meta_type'],
constructors= (all_constructors[i],),
permission = ADD_CONTENT_PERMISSIONS[klassname])
##code-section custom-init-bottom #fill in your manual code here
##/code-section custom-init-bottom