Back to index

plone3  3.1.7
setuphandlers.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # Copyright (c) 2005 Zope Corporation and Contributors. All Rights Reserved.
00004 #
00005 # This software is subject to the provisions of the Zope Public License,
00006 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
00007 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00008 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00009 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00010 # FOR A PARTICULAR PURPOSE.
00011 #
00012 ##############################################################################
00013 """ CMFCalendar setup handlers.
00014 
00015 $Id: setuphandlers.py 73035 2007-03-07 16:41:03Z jens $
00016 """
00017 
00018 from zope.component import getUtility
00019 
00020 from Products.CMFCore.interfaces import IMetadataTool
00021 
00022 from exceptions import MetadataError
00023 
00024 
00025 def importVarious(context):
00026     """ Import various settings for CMF Calendar.
00027 
00028     This provisional handler will be removed again as soon as full handlers
00029     are implemented for these steps.
00030     """
00031     site = context.getSite()
00032     mdtool = getUtility(IMetadataTool)
00033 
00034     # Set up a MetadataTool element policy for events
00035     try:
00036         _ = str # MetadataTool ist not aware of Message objects
00037         mdtool.DCMI.addElementPolicy(
00038             element='Subject',
00039             content_type='Event',
00040             is_required=0,
00041             supply_default=0,
00042             default_value='',
00043             enforce_vocabulary=0,
00044             allowed_vocabulary=(_('Appointment'),
00045                                 _('Convention'),
00046                                 _('Meeting'),
00047                                 _('Social Event'),
00048                                 _('Work'),
00049                                ),
00050             REQUEST=None)
00051     except MetadataError:
00052         pass
00053 
00054     return 'Various settings for CMF Calendar imported.'