source: ATGoogleMaps/branches/for-plone30/__init__.py @ 194

Revision 194, 3.5 KB checked in by takanori, 4 years ago (diff)

move directory

Line 
1# -*- coding: utf-8 -*-
2#
3# File: ATGoogleMaps.py
4#
5# Copyright (c) 2008 by ['takanori', 'yuta']
6# Generator: ArchGenXML Version 2.1
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__ = """takanori <takanori@takanory.net>, yuta <unknown>"""
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
39import logging
40logger = logging.getLogger('ATGoogleMaps')
41logger.debug('Installing Product')
42
43import os
44import os.path
45from Globals import package_home
46import Products.CMFPlone.interfaces
47from Products.Archetypes import listTypes
48from Products.Archetypes.atapi import *
49from Products.Archetypes.utils import capitalize
50from Products.CMFCore import DirectoryView
51from Products.CMFCore import permissions as cmfpermissions
52from Products.CMFCore import utils as cmfutils
53from Products.CMFPlone.utils import ToolInit
54from config import *
55
56DirectoryView.registerDirectory('skins', product_globals)
57
58
59##code-section custom-init-head #fill in your manual code here
60##/code-section custom-init-head
61
62
63def initialize(context):
64    """initialize product (called by zope)"""
65    ##code-section custom-init-top #fill in your manual code here
66    ##/code-section custom-init-top
67
68    # imports packages and types for registration
69    import content
70
71    import LatLngWidget
72    import LatLngField
73    import LatLngValidator
74
75    # Initialize portal content
76    all_content_types, all_constructors, all_ftis = process_types(
77        listTypes(PROJECTNAME),
78        PROJECTNAME)
79
80    cmfutils.ContentInit(
81        PROJECTNAME + ' Content',
82        content_types      = all_content_types,
83        permission         = DEFAULT_ADD_CONTENT_PERMISSION,
84        extra_constructors = all_constructors,
85        fti                = all_ftis,
86        ).initialize(context)
87
88    # Give it some extra permissions to control them on a per class limit
89    for i in range(0,len(all_content_types)):
90        klassname=all_content_types[i].__name__
91        if not klassname in ADD_CONTENT_PERMISSIONS:
92            continue
93
94        context.registerClass(meta_type   = all_ftis[i]['meta_type'],
95                              constructors= (all_constructors[i],),
96                              permission  = ADD_CONTENT_PERMISSIONS[klassname])
97
98    ##code-section custom-init-bottom #fill in your manual code here
99    ##/code-section custom-init-bottom
100
Note: See TracBrowser for help on using the repository browser.