| 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 | |
|---|
| 39 | import logging |
|---|
| 40 | logger = logging.getLogger('ATGoogleMaps') |
|---|
| 41 | logger.debug('Installing Product') |
|---|
| 42 | |
|---|
| 43 | import os |
|---|
| 44 | import os.path |
|---|
| 45 | from Globals import package_home |
|---|
| 46 | import Products.CMFPlone.interfaces |
|---|
| 47 | from Products.Archetypes import listTypes |
|---|
| 48 | from Products.Archetypes.atapi import * |
|---|
| 49 | from Products.Archetypes.utils import capitalize |
|---|
| 50 | from Products.CMFCore import DirectoryView |
|---|
| 51 | from Products.CMFCore import permissions as cmfpermissions |
|---|
| 52 | from Products.CMFCore import utils as cmfutils |
|---|
| 53 | from Products.CMFPlone.utils import ToolInit |
|---|
| 54 | from config import * |
|---|
| 55 | |
|---|
| 56 | DirectoryView.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 | |
|---|
| 63 | def 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 | |
|---|