Changeset 1593 in products
- Timestamp:
- Jan 26, 2010 6:47:51 PM (14 years ago)
- Location:
- quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps
- Files:
-
- 57 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/__init__.py
r1591 r1593 1 import Globals 2 3 from Products.CMFCore.DirectoryView import registerDirectory 4 from AccessControl import allow_module 5 6 registerDirectory('skins', globals()) 7 qPGS_globals = globals() 8 9 allow_module('quintagroup.plonegooglesitemaps.utils.py') 10 allow_module('quintagroup.plonegooglesitemaps.config.py') 11 12 from zope.i18nmessageid import MessageFactory 13 from quintagroup.plonegooglesitemaps import config 14 15 from Products.Archetypes import atapi 16 from Products.CMFCore.utils import ContentInit 17 from Products.CMFCore.permissions import setDefaultRoles 18 19 # Define a message factory for when this product is internationalised. 20 # This will be imported with the special name "_" in most modules. Strings 21 # like _(u"message") will then be extracted by i18n tools for translation. 22 23 qPloneGoogleSitemapsMessageFactory = MessageFactory('qPloneGoogleSitemaps') 1 24 2 25 def initialize(context): 3 """Initializer called when used as a Zope 2 product.""" 26 """Initializer called when used as a Zope 2 product. 27 28 This is referenced from configure.zcml. Regstrations as a "Zope 2 product" 29 is necessary for GenericSetup profiles to work, for example. 30 31 Here, we call the Archetypes machinery to register our content types 32 with Zope and the CMF. 33 """ 34 35 # Retrieve the content types that have been registered with Archetypes 36 # This happens when the content type is imported and the registerType() 37 # call in the content type's module is invoked. Actually, this happens 38 # during ZCML processing, but we do it here again to be explicit. Of 39 # course, even if we import the module several times, it is only run 40 # once. 41 42 content_types, constructors, ftis = atapi.process_types( 43 atapi.listTypes(config.PROJECTNAME), 44 config.PROJECTNAME) 45 46 # Now initialize all these content types. The initialization process takes 47 # care of registering low-level Zope 2 factories, including the relevant 48 # add-permission. These are listed in config.py. We use different 49 # permissions for each content type to allow maximum flexibility of who 50 # can add which content types, where. The roles are set up in rolemap.xml 51 # in the GenericSetup profile. 52 53 for atype, constructor in zip(content_types, constructors): 54 ContentInit('%s: %s' % (config.PROJECTNAME, atype.portal_type), 55 content_types = (atype,), 56 permission = config.ADD_PERMISSIONS[atype.portal_type], 57 extra_constructors = (constructor,), 58 ).initialize(context) -
quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/configure.zcml
r1591 r1593 2 2 xmlns="http://namespaces.zope.org/zope" 3 3 xmlns:five="http://namespaces.zope.org/five" 4 xmlns:genericsetup="http://namespaces.zope.org/genericsetup" 4 5 i18n_domain="quintagroup.plonegooglesitemaps"> 5 6 6 <five:registerPackage package="." initialize=".initialize" /> 7 <!-- Include the sub-packages that use their own configure.zcml files. --> 8 <include package=".browser" /> 9 <include package=".content" /> 10 11 <!-- Register the installation GenericSetup extension profile --> 12 <genericsetup:registerProfile 13 name="default" 14 title="Plone Google Sitemaps" 15 directory="profiles/default" 16 description="" 17 provides="Products.GenericSetup.interfaces.EXTENSION" 18 /> 19 20 <!-- -*- extra stuff goes here -*- --> 21 22 <subscriber handler=".handlers.pingGoogle"/> 7 23 8 24 </configure>
Note: See TracChangeset
for help on using the changeset viewer.