Changeset 51312
- Timestamp:
- 03/09/07 12:36:13 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
CPS3/products/CPSDefault/trunk/CHANGES
r51244 r51312 4 4 New features 5 5 ~~~~~~~~~~~~ 6 - 6 - Added the possibility to create any objects at the root of a CPS site 7 (for example Zope objects such as cache managers) by specifying them in 8 profiles/default/roots.xml. Previously it was limited to only CPS objects. 7 9 Bug fixes 8 10 ~~~~~~~~~ CPS3/products/CPSDefault/trunk/exportimport.py
r50176 r51312 1 # (C) Copyright 2005-2006 Nuxeo SAS <http://nuxeo.com> 2 # Author: Florent Guillaume <fg@nuxeo.com> 1 # (C) Copyright 2005-2007 Nuxeo SAS <http://nuxeo.com> 2 # Authors: 3 # Florent Guillaume <fg@nuxeo.com> 4 # M.-A. Darche <madarche@nuxeo.com> 3 5 # 4 6 # This program is free software; you can redistribute it and/or modify … … 21 23 22 24 from Acquisition import aq_base 25 26 import Products 27 23 28 from Products.StandardCacheManagers.AcceleratedHTTPCacheManager \ 24 29 import AcceleratedHTTPCacheManager 25 30 from Products.CMFCore.utils import getToolByName 31 32 from Products.GenericSetup.utils import CONVERTER, DEFAULT, KEY 26 33 from Products.GenericSetup.utils import XMLAdapterBase 27 34 from Products.GenericSetup.utils import ObjectManagerHelpers 28 35 from Products.GenericSetup.utils import ImportConfiguratorBase 29 from Products.GenericSetup.utils import CONVERTER, DEFAULT, KEY36 from Products.GenericSetup.utils import importObjects 30 37 31 38 from Products.CPSCore.utils import ALL_LOCALES … … 71 78 self.setupTranslationService() 72 79 self.setupRoots() 73 self.setupFCKeditorHttpCache()74 80 self.setupDefaultRoles() 75 81 return "Various settings imported." … … 104 110 importer.body = body 105 111 106 def setupFCKeditorHttpCache(self):107 if 'FckHTTPCache' in self.site.objectIds():108 return109 self.site._setObject('FckHTTPCache',110 AcceleratedHTTPCacheManager('FckHTTPCache'))111 cache_settings = {'anonymous_only' : 0,112 'notify_urls' : (),113 'interval' :1728000114 }115 self.site.FckHTTPCache.manage_editProps('FCK Http Cache',116 settings=cache_settings)117 118 112 119 113 # Called according to import_steps.xml … … 157 151 158 152 id = str(child.getAttribute('name')) 153 portal_type = str(child.getAttribute('portal_type')) 154 meta_type = str(child.getAttribute('meta_type')) 159 155 160 156 # Create object if needed 161 157 if getattr(aq_base(site), id, None) is None: 162 portal_type = str(child.getAttribute('portal_type')) 163 language = str(child.getAttribute('language')) 164 if language not in avail_langs: 165 language = None 166 wftool = getToolByName(site, 'portal_workflow') 167 wftool.invokeFactoryFor(site, portal_type, id, 168 language=language) 169 proxy = site._getOb(id) 170 171 # Placeful configuration for one root (and creates subobjects) 172 path = self.path+'/'+id 173 filename = path+'.xml' 158 # If this is a CPS document such as a Workspace or a Section 159 if portal_type: 160 language = str(child.getAttribute('language')) 161 if language not in avail_langs: 162 language = None 163 wftool = getToolByName(site, 'portal_workflow') 164 wftool.invokeFactoryFor(site, portal_type, id, 165 language=language) 166 else: 167 # This is not a CPS document such as a Workspace or a 168 # Section and thus it can be dealt with in a generic manner. 169 for mt_info in Products.meta_types: 170 if mt_info['name'] == meta_type: 171 site._setObject(id, mt_info['instance'](id)) 172 break 173 else: 174 raise ValueError("unknown meta_type '%s'" % meta_type) 175 176 obj = site._getOb(id) 177 178 if not portal_type: 179 #self._logger.debug( 180 # "_initRoots importObjects on %s with parent_path = %s" 181 # % (str(obj), self.path)) 182 # Import subobjects recursively 183 importObjects(obj, self.path + '/', self.environ) 184 # Move on to the next root object 185 continue 186 187 # Placeful configuration for one root object 188 # (and subobjects creation). 189 path = self.path + '/' + id 190 filename = path + '.xml' 191 174 192 body = self.environ.readDataFile(filename) 175 193 if body is not None: 176 importer = RootXMLAdapter( proxy, self.environ)194 importer = RootXMLAdapter(obj, self.environ) 177 195 importer.path = path # to load rolemap contextually 178 196 importer.filename = filename # for error reporting … … 180 198 181 199 # Recurse into configuration objects 182 for subid, subob in proxy.objectItems():200 for subid, subob in obj.objectItems(): 183 201 if subid.startswith('.'): 184 importCPSObjects(subob, path +'/', self.environ)185 186 # Recursively load sub proxyfolders202 importCPSObjects(subob, path + '/', self.environ) 203 204 # Recursively load sub obj folders 187 205 filename = path + '/' + self.name + '.xml' 188 206 body = self.environ.readDataFile(filename) 189 207 if body is not None: 190 importer = RootsXMLAdapter( proxy, self.environ)208 importer = RootsXMLAdapter(obj, self.environ) 191 209 importer.path = path + '/' + self.name 192 210 importer.filename = filename # for error reporting CPS3/products/CPSDefault/trunk/profiles/default/roots.xml
r32410 r51312 4 4 <object name="sections" portal_type="Section"/> 5 5 <object name="workspaces" portal_type="Workspace"/> 6 <object name="FckHTTPCache" meta_type="Accelerated HTTP Cache Manager"/> 7 <!-- 8 <object name="portlet_lookup_ramcache" meta_type="RAM Cache Manager"/> 9 --> 6 10 </roots>
