[CMF-checkins] CVS: CMF/CMFSetup - factory.py:1.5 skins.py:1.10
Jens Vagelpohl
jens at dataflake.org
Mon Feb 28 16:23:57 EST 2005
Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv8139
Modified Files:
factory.py skins.py
Log Message:
- Small feature extensions to make CMFSetup more "unittest-friendly".
Stumbled over these converting from the soon deprecated manage_addCMFSite
to addConfiguredSite from within the CMF unit tests
- Sometimes it is not necessary or desirable to create a snapshot upon
initial site creation. Matter of fact when run in a unit test
situation, addConfiguredSite can throw permission errors during the
snapshot-taking because no specific SecurityManager has been set up.
Add new flag "snapshot" to factory.addConfiguredSite to turn off
snapshotting if desired
- CMFSetup.skins made the assumption that the CMF site can always
acquire REQUEST and would set up the current skin with it. Added a test
to see if REQUEST is available and if it is not, skip the step that
sets up the current skin.
=== CMF/CMFSetup/factory.py 1.4 => 1.5 ===
--- CMF/CMFSetup/factory.py:1.4 Thu Jan 20 14:00:19 2005
+++ CMF/CMFSetup/factory.py Mon Feb 28 16:23:56 2005
@@ -32,7 +32,12 @@
return wrapped( profiles=profile_registry.listProfileInfo() )
-def addConfiguredSite( dispatcher, site_id, profile_id, RESPONSE=None ):
+def addConfiguredSite( dispatcher
+ , site_id
+ , profile_id
+ , snapshot=True
+ , RESPONSE=None
+ ):
""" Add a CMFSite to 'dispatcher', configured according to 'profile_id'.
"""
@@ -46,7 +51,9 @@
setup_tool.setImportContext( 'profile-%s' % profile_id )
setup_tool.runAllImportSteps()
- setup_tool.createSnapshot( 'initial_configuration' )
+
+ if snapshot is True:
+ setup_tool.createSnapshot( 'initial_configuration' )
if RESPONSE is not None:
RESPONSE.redirect( '%s/manage_main?update_menu=1'
=== CMF/CMFSetup/skins.py 1.9 => 1.10 ===
--- CMF/CMFSetup/skins.py:1.9 Tue Dec 14 15:56:57 2004
+++ CMF/CMFSetup/skins.py Mon Feb 28 16:23:56 2005
@@ -102,9 +102,12 @@
#
# Purge and rebuild the skin path, now that we have added our stuff.
+ # Don't bother if no REQUEST is present, e.g. when running unit tests
#
- site._v_skindata = None
- skins_tool.setupCurrentSkin( site.REQUEST )
+ request = getattr(site, 'REQUEST', None)
+ if request is not None:
+ site._v_skindata = None
+ skins_tool.setupCurrentSkin(request)
return 'Skins tool imported'
More information about the CMF-checkins
mailing list