Ignore:
Timestamp:
Jan 26, 2010 6:47:51 PM (14 years ago)
Author:
mylan
Message:

Add content from qPloneGoogleSitemaps. Fix all imports

File:
1 edited

Legend:

Unmodified
Added
Removed
  • quintagroup.plonegooglesitemaps/trunk/quintagroup/plonegooglesitemaps/__init__.py

    r1591 r1593  
     1import Globals 
     2 
     3from Products.CMFCore.DirectoryView import registerDirectory 
     4from AccessControl import allow_module 
     5 
     6registerDirectory('skins', globals()) 
     7qPGS_globals = globals() 
     8 
     9allow_module('quintagroup.plonegooglesitemaps.utils.py') 
     10allow_module('quintagroup.plonegooglesitemaps.config.py') 
     11 
     12from zope.i18nmessageid import MessageFactory 
     13from quintagroup.plonegooglesitemaps import config 
     14 
     15from Products.Archetypes import atapi 
     16from Products.CMFCore.utils import ContentInit 
     17from 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 
     23qPloneGoogleSitemapsMessageFactory = MessageFactory('qPloneGoogleSitemaps') 
    124 
    225def 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) 
Note: See TracChangeset for help on using the changeset viewer.