[CMF-checkins] CVS: Products/CMFCalendar - exceptions.py:1.1 setuphandlers.py:1.1

Yvo Schubbe y.2005- at wcm-solutions.de
Wed Mar 16 03:35:57 EST 2005


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

Added Files:
	exceptions.py setuphandlers.py 
Log Message:
- added provisional import handler for those steps of Install.py that currently can't be replaced with normal import steps


=== Added File Products/CMFCalendar/exceptions.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 product exceptions.

$Id: exceptions.py,v 1.1 2005/03/16 08:35:56 yuppie Exp $
"""

from AccessControl import ModuleSecurityInfo
security = ModuleSecurityInfo('Products.CMFCalendar.exceptions')

security.declarePublic('CatalogError')
from Products.ZCatalog.Catalog import CatalogError

security.declarePublic('MetadataError')
from Products.CMFDefault.exceptions import MetadataError


=== 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 2005/03/16 08:35:56 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.'



More information about the CMF-checkins mailing list