source: products/quintagroup.plonegooglesitemaps/tags/1.5.6/quintagroup/plonegooglesitemaps/__init__.py @ 3665

Last change on this file since 3665 was 2841, checked in by mylan, 10 years ago

Added support of migration from qPloneGoogleSitemaps product
to quintagroup.plonegooglesitemaps with tests.
Also all views now registered on own browserlayer.

Merged revisions 3865,3867-3872,3874-3878 via svnmerge from
http://svn.quintagroup.com/products/quintagroup.plonegooglesitemaps/branches/migratioin_product

........

r3865 | mylan | 2010-09-15 20:54:50 +0300 (Wed, 15 Sep 2010) | 1 line


#230: Added module aliases - prevent breakage sitemap, created with qPloneGoogleSitemaps

........

r3867 | mylan | 2010-09-17 11:41:35 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added browserlayer and registered all sitemaps views and configlet view to it

........

r3868 | mylan | 2010-09-17 13:12:09 +0300 (Fri, 17 Sep 2010) | 1 line


#230: remove module aliases

........

r3869 | mylan | 2010-09-17 13:13:14 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added migration from qPloneGoogleSitemaps to quintagroup.plonegooglesitemaps

........

r3870 | mylan | 2010-09-17 14:02:47 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added upgrade/migration step by step reference.

........

r3871 | mylan | 2010-09-17 14:41:04 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Fix tests after registering all views to the browser layer

........

r3872 | mylan | 2010-09-17 14:55:43 +0300 (Fri, 17 Sep 2010) | 1 line


#230: Added uninstallation browserlayer and updated install/uninstall tests

........

r3874 | mylan | 2010-09-20 13:12:26 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Added test for browser layer uninstallation

........

r3875 | mylan | 2010-09-20 15:37:00 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Fix cleanup during migration from the qPloneGoogleSitemaps

........

r3876 | mylan | 2010-09-20 15:38:18 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Fix typos in GS profile and import step

........

r3877 | mylan | 2010-09-20 18:23:20 +0300 (Mon, 20 Sep 2010) | 1 line


#230: Added tests of migration from qPloneGoogleSitemap to quintagroup.plonegooglesitemap.

........

r3878 | mylan | 2010-09-22 14:17:07 +0300 (Wed, 22 Sep 2010) | 1 line


#230: some upgrade tests reorganization

........

  • Property svn:eol-style set to native
File size: 2.3 KB
Line 
1import sys
2from AccessControl import allow_module
3
4allow_module('quintagroup.plonegooglesitemaps.utils.py')
5allow_module('quintagroup.plonegooglesitemaps.config.py')
6
7from zope.i18nmessageid import MessageFactory
8from quintagroup.plonegooglesitemaps import config
9
10from Products.Archetypes import atapi
11from Products.CMFCore.utils import ContentInit
12from Products.CMFCore.permissions import setDefaultRoles
13
14# Define a message factory for when this product is internationalised.
15# This will be imported with the special name "_" in most modules. Strings
16# like _(u"message") will then be extracted by i18n tools for translation.
17
18qPloneGoogleSitemapsMessageFactory = MessageFactory('qPloneGoogleSitemaps')
19
20def initialize(context):
21    """Initializer called when used as a Zope 2 product.
22
23    This is referenced from configure.zcml. Regstrations as a "Zope 2 product"
24    is necessary for GenericSetup profiles to work, for example.
25
26    Here, we call the Archetypes machinery to register our content types
27    with Zope and the CMF.
28    """
29
30    # Retrieve the content types that have been registered with Archetypes
31    # This happens when the content type is imported and the registerType()
32    # call in the content type's module is invoked. Actually, this happens
33    # during ZCML processing, but we do it here again to be explicit. Of
34    # course, even if we import the module several times, it is only run
35    # once.
36
37    content_types, constructors, ftis = atapi.process_types(
38        atapi.listTypes(config.PROJECTNAME),
39        config.PROJECTNAME)
40
41    # Now initialize all these content types. The initialization process takes
42    # care of registering low-level Zope 2 factories, including the relevant
43    # add-permission. These are listed in config.py. We use different
44    # permissions for each content type to allow maximum flexibility of who
45    # can add which content types, where. The roles are set up in rolemap.xml
46    # in the GenericSetup profile.
47
48    for atype, constructor in zip(content_types, constructors):
49        ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type),
50            content_types      = (atype,),
51            permission         = config.ADD_PERMISSIONS[atype.portal_type],
52            extra_constructors = (constructor,),
53            ).initialize(context)
Note: See TracBrowser for help on using the repository browser.