Package platecom :: Package langview :: Module setuphandlers
[hide private]
[frames] | no frames]

Source Code for Module icsemantic.langfallback.setuphandlers

 1  ############################################################################## 
 2  # 
 3  # Copyright (c) 2004 Zope Corporation and Contributors. All Rights Reserved. 
 4  # 
 5  # This software is subject to the provisions of the Zope Public License, 
 6  # Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution. 
 7  # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED 
 8  # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 9  # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS 
10  # FOR A PARTICULAR PURPOSE. 
11  # 
12  ############################################################################## 
13  """ CMFDefault setup handlers. 
14   
15  $Id: platecom.langview.setuphandlers-pysrc.html 236 2008-06-10 20:28:23Z crocha $ 
16  """ 
17  from StringIO import StringIO 
18   
19  from zope.component import getUtility 
20  from Products.CMFCore.utils import getToolByName 
21   
22  from platecom.utils.interfaces import IContentTypesMultilingualPatcher 
23   
24 -def patchPortalTypes(portal, out):
25 """ 26 """ 27 archetype_tool = getToolByName( portal, 'archetype_tool') 28 # import pdb;pdb.set_trace() 29 for atype in archetype_tool.listTypes(): 30 print >> out, 'Patching getters for %s' % atype 31 if hasattr(atype, 'getLanguage'): 32 ccpatcher = getUtility(IContentTypesMultilingualPatcher) 33 ccpatcher.patch(atype)
34
35 -def unpatchPortalTypes(portal, out):
36 """ 37 """ 38 archetype_tool = getToolByName( portal, 'archetype_tool') 39 for atype in archetype_tool.listTypes(): 40 if hasattr(atype, 'getLanguage'): 41 ccpatcher = getUtility(IContentTypesMultilingualPatcher) 42 ccpatcher.unpatch(atype)
43
44 -def importVarious(context):
45 """ Import various settings. 46 47 This provisional handler will be removed again as soon as full handlers 48 are implemented for these steps. 49 """ 50 site = context.getSite() 51 out = StringIO() 52 logger = context.getLogger("icsemantic.langfallback") 53 54 # patchPortalTypes(site, out) 55 56 print >> out, 'Various settings imported.' 57 58 logger.info(out.getvalue()) 59 return out.getvalue()
60
61 -def unimportVarious(context):
62 """ Import various settings. 63 64 This provisional handler will be removed again as soon as full handlers 65 are implemented for these steps. 66 """ 67 site = context.getSite() 68 69 return 'Various settings imported.'
70