[CMF-checkins] CVS: Products/CMFCalendar - setuphandlers.py:1.1.2.1 __init__.py:1.9.2.1

Yvo Schubbe y.2005- at wcm-solutions.de
Tue Apr 5 11:17:47 EDT 2005


Update of /cvs-repository/Products/CMFCalendar
In directory cvs.zope.org:/tmp/cvs-serv8223/CMFCalendar

Modified Files:
      Tag: CMF-1_5-branch
	__init__.py 
Added Files:
      Tag: CMF-1_5-branch
	setuphandlers.py 
Log Message:
backported recent CMFSetup changes from HEAD to CMF-1_5-branch


=== Added File Products/CMFCalendar/setuphandlers.py ===
##############################################################################
#
# Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
""" CMFCalendar setup handlers.

$Id: setuphandlers.py,v 1.1.2.1 2005/04/05 15:17:16 yuppie Exp $
"""

from Products.CMFCore.utils import getToolByName

from exceptions import CatalogError
from exceptions import MetadataError


def importVarious(context):
    """ Import various settings for CMF Calendar.

    This provisional handler will be removed again as soon as full handlers
    are implemented for these steps.
    """
    site = context.getSite()
    ctool = getToolByName(site, 'portal_catalog')
    mdtool = getToolByName(site, 'portal_metadata')

    # Set up a catalog indexes and metadata
    try:
        ctool.addIndex('start', 'DateIndex')
    except CatalogError:
        pass
    try:
        ctool.addIndex('end', 'DateIndex')
    except CatalogError:
        pass
    try:
        ctool.addColumn('start')
    except CatalogError:
        pass
    try:
        ctool.addColumn('end')
    except CatalogError:
        pass

    # Set up a MetadataTool element policy for events
    try:
        mdtool.addElementPolicy(
            element='Subject',
            content_type='Event',
            is_required=0,
            supply_default=0,
            default_value='',
            enforce_vocabulary=0,
            allowed_vocabulary=('Appointment', 'Convention', 'Meeting',
                                'Social Event', 'Work'),
            REQUEST=None)
    except MetadataError:
        pass

    return 'Various settings for CMF Calendar imported.'


=== Products/CMFCalendar/__init__.py 1.9 => 1.9.2.1 ===
--- Products/CMFCalendar/__init__.py:1.9	Thu Aug 12 11:07:37 2004
+++ Products/CMFCalendar/__init__.py	Tue Apr  5 11:17:16 2005
@@ -19,6 +19,12 @@
 
 from Products.CMFCore import utils
 from Products.CMFCore.DirectoryView import registerDirectory
+try:
+    from Products.CMFSetup import EXTENSION
+    from Products.CMFSetup import profile_registry
+    has_profile_registry = True
+except ImportError:
+    has_profile_registry = False
 
 import Event
 import CalendarTool
@@ -55,3 +61,11 @@
                      , extra_constructors = contentConstructors
                      , fti = Event.factory_type_information
                      ).initialize( context )
+
+    if has_profile_registry:
+        profile_registry.registerProfile('default',
+                                         'CMFCalendar',
+                                         'Adds calendar support.',
+                                         'profiles/default',
+                                         'CMFCalendar',
+                                         EXTENSION)



More information about the CMF-checkins mailing list