[Checkins]
SVN: Products.GenericSetup/branches/1.3/Products/GenericSetup/
Merge r81937 from trunk
Wichert Akkerman
wichert at wiggy.net
Mon Nov 19 17:44:48 EST 2007
Log message for revision 81939:
Merge r81937 from trunk
Changed:
U Products.GenericSetup/branches/1.3/Products/GenericSetup/CHANGES.txt
U Products.GenericSetup/branches/1.3/Products/GenericSetup/tests/test_tool.py
U Products.GenericSetup/branches/1.3/Products/GenericSetup/tool.py
-=-
Modified: Products.GenericSetup/branches/1.3/Products/GenericSetup/CHANGES.txt
===================================================================
--- Products.GenericSetup/branches/1.3/Products/GenericSetup/CHANGES.txt 2007-11-19 22:35:51 UTC (rev 81938)
+++ Products.GenericSetup/branches/1.3/Products/GenericSetup/CHANGES.txt 2007-11-19 22:44:48 UTC (rev 81939)
@@ -1,5 +1,12 @@
GenericSetup Product Changelog
+ GenericSetup 1.3.3 (unreleased)
+
+ - Be more careful in checking context id validity.
+
+ - Fire events before and after importing.
+
+
GenericSetup 1.3.2 (2007/09/11)
- Ignore import and export step handlers that we can not resolve.
Modified: Products.GenericSetup/branches/1.3/Products/GenericSetup/tests/test_tool.py
===================================================================
--- Products.GenericSetup/branches/1.3/Products/GenericSetup/tests/test_tool.py 2007-11-19 22:35:51 UTC (rev 81938)
+++ Products.GenericSetup/branches/1.3/Products/GenericSetup/tests/test_tool.py 2007-11-19 22:44:48 UTC (rev 81939)
@@ -119,6 +119,15 @@
, 'profile-foo'
)
+ def test_setBaselineContext_empty_string( self ):
+
+ tool = self._makeOne('setup_tool')
+
+ self.assertRaises( KeyError
+ , tool.setBaselineContext
+ , ''
+ )
+
def test_setBaselineContext( self ):
from Products.GenericSetup.tool import IMPORT_STEPS_XML
@@ -172,7 +181,7 @@
tool = self._makeOne('setup_tool').__of__( site )
- self.assertRaises( ValueError, tool.runImportStepFromProfile,
+ self.assertRaises( KeyError, tool.runImportStepFromProfile,
'', 'nonesuch' )
def test_runImportStep_simple( self ):
@@ -185,7 +194,7 @@
registry = tool.getImportStepRegistry()
registry.registerStep( 'simple', '1', _uppercaseSiteTitle )
- result = tool.runImportStepFromProfile( '', 'simple' )
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'simple' )
self.assertEqual( len( result[ 'steps' ] ), 1 )
@@ -207,7 +216,7 @@
registry.registerStep( 'dependent', '1'
, _uppercaseSiteTitle, ( 'dependable', ) )
- result = tool.runImportStepFromProfile( '', 'dependent' )
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'dependent' )
self.assertEqual( len( result[ 'steps' ] ), 2 )
@@ -232,7 +241,7 @@
registry.registerStep( 'dependent', '1'
, _uppercaseSiteTitle, ( 'dependable', ) )
- result = tool.runImportStepFromProfile( '', 'dependent',
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'dependent',
run_dependencies=False )
self.assertEqual( len( result[ 'steps' ] ), 1 )
@@ -251,7 +260,7 @@
registry = tool.getImportStepRegistry()
registry.registerStep( 'purging', '1', _purgeIfRequired )
- result = tool.runImportStepFromProfile( '', 'purging' )
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'purging' )
self.assertEqual( len( result[ 'steps' ] ), 1 )
self.assertEqual( result[ 'steps' ][ 0 ], 'purging' )
@@ -266,7 +275,7 @@
registry = tool.getImportStepRegistry()
registry.registerStep( 'purging', '1', _purgeIfRequired )
- result = tool.runImportStepFromProfile( '', 'purging',
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'purging',
purge_old=True )
self.assertEqual( len( result[ 'steps' ] ), 1 )
@@ -282,7 +291,7 @@
registry = tool.getImportStepRegistry()
registry.registerStep( 'purging', '1', _purgeIfRequired )
- result = tool.runImportStepFromProfile( '', 'purging',
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'purging',
purge_old=False )
self.assertEqual( len( result[ 'steps' ] ), 1 )
@@ -301,7 +310,7 @@
registry.registerStep( 'dependent', '1'
, _uppercaseSiteTitle, ( 'purging', ) )
- result = tool.runImportStepFromProfile( '', 'dependent',
+ result = tool.runImportStepFromProfile( 'snapshot-dummy', 'dependent',
purge_old=False )
self.failIf( site.purged )
@@ -310,14 +319,14 @@
site = self._makeSite()
tool = self._makeOne('setup_tool').__of__( site )
- result = tool.runAllImportStepsFromProfile('')
+ result = tool.runAllImportStepsFromProfile('snapshot-dummy')
self.assertEqual( len( result[ 'steps' ] ), 0 )
def test_runAllImportSteps_sorted_default_purge( self ):
TITLE = 'original title'
- PROFILE_ID = 'testing'
+ PROFILE_ID = 'snapshot-testing'
site = self._makeSite( TITLE )
tool = self._makeOne('setup_tool').__of__( site )
@@ -355,7 +364,7 @@
def test_runAllImportSteps_unicode_profile_id_creates_reports( self ):
TITLE = 'original title'
- PROFILE_ID = u'testing'
+ PROFILE_ID = u'snapshot-testing'
site = self._makeSite( TITLE )
tool = self._makeOne('setup_tool').__of__( site )
@@ -386,7 +395,7 @@
registry.registerStep( 'purging', '1'
, _purgeIfRequired )
- result = tool.runAllImportStepsFromProfile( '', purge_old=True )
+ result = tool.runAllImportStepsFromProfile( 'snapshot-dummy', purge_old=True )
self.assertEqual( len( result[ 'steps' ] ), 3 )
@@ -411,7 +420,7 @@
registry.registerStep( 'purging', '1'
, _purgeIfRequired )
- result = tool.runAllImportStepsFromProfile( '', purge_old=False )
+ result = tool.runAllImportStepsFromProfile( 'snapshot-dummy', purge_old=False )
self.assertEqual( len( result[ 'steps' ] ), 3 )
Modified: Products.GenericSetup/branches/1.3/Products/GenericSetup/tool.py
===================================================================
--- Products.GenericSetup/branches/1.3/Products/GenericSetup/tool.py 2007-11-19 22:35:51 UTC (rev 81938)
+++ Products.GenericSetup/branches/1.3/Products/GenericSetup/tool.py 2007-11-19 22:44:48 UTC (rev 81939)
@@ -898,11 +898,13 @@
should_purge = (info.get('type') != EXTENSION)
return DirectoryImportContext(self, path, should_purge, encoding)
- # else snapshot
- context_id = context_id[len('snapshot-'):]
- if should_purge is None:
- should_purge = True
- return SnapshotImportContext(self, context_id, should_purge, encoding)
+ elif context_id.startswith('snapshot-'):
+ context_id = context_id[len('snapshot-'):]
+ if should_purge is None:
+ should_purge = True
+ return SnapshotImportContext(self, context_id, should_purge, encoding)
+ else:
+ raise KeyError, 'Unknown context %s' % context_id
security.declarePrivate('_updateImportStepsRegistry')
def _updateImportStepsRegistry(self, context, encoding):
More information about the Checkins
mailing list