Back to index

plone3  3.1.7
utils.py
Go to the documentation of this file.
00001 import logging
00002 
00003 from Acquisition import aq_base
00004 from zExceptions import BadRequest
00005 
00006 logger = logging.getLogger('CMFQuickInstallerTool')
00007 
00008 def updatelist(a, b, c=None):
00009     for l in b:
00010         if not l in a:
00011             if c is None:
00012                 a.append(l)
00013             else:
00014                 if not l in c:
00015                     a.append(l)
00016 
00017 def delObjects(cont, ids):
00018     """ abbreviation to delete objects """
00019     delids=[id for id in ids if hasattr(aq_base(cont),id)]
00020     for delid in delids:
00021         try:
00022             cont.manage_delObjects(delid)
00023         except (AttributeError, KeyError, BadRequest):
00024             logger.warning("Failed to delete '%s' in '%s'" % (delid, cont.id))