source: publico/ILPortal/trunk/__init__.py @ 2461

Última Alteração nesse arquivo desde 2461 foi 2461, incluída por paulovieira, 13 anos atrás

alteração no modelo e geração de código

File size: 4.0 KB
Linha 
1# -*- coding: utf-8 -*-
2#
3# File: ILPortal.py
4#
5# Copyright (c) 2006 by Interlegis
6# Generator: ArchGenXML Version 1.5.0 svn/devel
7#            http://plone.org/products/archgenxml
8#
9# GNU General Public License (GPL)
10#
11# This program is free software; you can redistribute it and/or
12# modify it under the terms of the GNU General Public License
13# as published by the Free Software Foundation; either version 2
14# of the License, or (at your option) any later version.
15#
16# This program is distributed in the hope that it will be useful,
17# but WITHOUT ANY WARRANTY; without even the implied warranty of
18# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19# GNU General Public License for more details.
20#
21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
24# 02110-1301, USA.
25#
26
27__author__ = """STC Interlegis <admin-stc@interlegis.gov.br>"""
28__docformat__ = 'plaintext'
29
30
31# There are three ways to inject custom code here:
32#
33#   - To set global configuration variables, create a file AppConfig.py.
34#       This will be imported in config.py, which in turn is imported in
35#       each generated class and in this file.
36#   - To perform custom initialisation after types have been registered,
37#       use the protected code section at the bottom of initialize().
38#   - To register a customisation policy, create a file CustomizationPolicy.py
39#       with a method register(context) to register the policy.
40
41from zLOG import LOG, INFO
42
43LOG('ILPortal',INFO, 'Installing Product')
44
45try:
46    import CustomizationPolicy
47except ImportError:
48    CustomizationPolicy = None
49
50from Globals import package_home
51from Products.CMFCore import utils as cmfutils
52from Products.CMFCore import CMFCorePermissions
53from Products.CMFCore import DirectoryView
54from Products.CMFPlone.PloneUtilities import ToolInit
55from Products.Archetypes.atapi import *
56from Products.Archetypes import listTypes
57from Products.Archetypes.utils import capitalize
58
59import os, os.path
60
61from Products.ILPortal.config import *
62
63DirectoryView.registerDirectory('skins', product_globals)
64DirectoryView.registerDirectory('skins/ILPortal',
65                                    product_globals)
66
67##code-section custom-init-head #fill in your manual code here
68from Products.ILPortal import Validators
69##/code-section custom-init-head
70
71
72def initialize(context):
73    ##code-section custom-init-top #fill in your manual code here
74    ##/code-section custom-init-top
75
76    # imports packages and types for registration
77
78    import MesaDiretora
79    import CasaLegislativa
80    import Parlamentar
81    import MembroMesaDiretora
82    import MemberFolder
83    import MelhoresPraticas
84    import VideoConferencia
85    import TextoPasta
86
87    # Initialize portal content
88    all_content_types, all_constructors, all_ftis = process_types(
89        listTypes(PROJECTNAME),
90        PROJECTNAME)
91
92    cmfutils.ContentInit(
93        PROJECTNAME + ' Content',
94        content_types      = all_content_types,
95        permission         = DEFAULT_ADD_CONTENT_PERMISSION,
96        extra_constructors = all_constructors,
97        fti                = all_ftis,
98        ).initialize(context)
99
100    # Give it some extra permissions to control them on a per class limit
101    for i in range(0,len(all_content_types)):
102        klassname=all_content_types[i].__name__
103        if not klassname in ADD_CONTENT_PERMISSIONS:
104            continue
105
106        context.registerClass(meta_type   = all_ftis[i]['meta_type'],
107                              constructors= (all_constructors[i],),
108                              permission  = ADD_CONTENT_PERMISSIONS[klassname])
109
110    # Apply customization-policy, if theres any
111    if CustomizationPolicy and hasattr(CustomizationPolicy, 'register'):
112        CustomizationPolicy.register(context)
113        print 'Customization policy for ILPortal installed'
114
115    ##code-section custom-init-bottom #fill in your manual code here
116    ##/code-section custom-init-bottom
117
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.