[Checkins] SVN: GenericSetup/ Revert 81968;
there is already a much simpler fix for this in the
eggified GenericSetup
Wichert Akkerman
wichert at wiggy.net
Fri Nov 23 13:22:34 EST 2007
Log message for revision 81970:
Revert 81968; there is already a much simpler fix for this in the eggified GenericSetup
Changed:
U GenericSetup/branches/1.2/tests/test_tool.py
U GenericSetup/branches/1.2/tool.py
U GenericSetup/branches/1.3/tests/test_tool.py
U GenericSetup/branches/1.3/tool.py
U GenericSetup/trunk/tests/test_tool.py
U GenericSetup/trunk/tool.py
-=-
Modified: GenericSetup/branches/1.2/tests/test_tool.py
===================================================================
--- GenericSetup/branches/1.2/tests/test_tool.py 2007-11-23 18:17:05 UTC (rev 81969)
+++ GenericSetup/branches/1.2/tests/test_tool.py 2007-11-23 18:22:34 UTC (rev 81970)
@@ -132,15 +132,6 @@
, 'profile-foo'
)
- def test_setBaselineContext_invalidFormat( self ):
-
- tool = self._makeOne('setup_tool')
-
- self.assertRaises( KeyError
- , tool.setImportContext
- , 'profile/default'
- )
-
def test_setImportContext( self ):
from Products.GenericSetup.tool import IMPORT_STEPS_XML
Modified: GenericSetup/branches/1.2/tool.py
===================================================================
--- GenericSetup/branches/1.2/tool.py 2007-11-23 18:17:05 UTC (rev 81969)
+++ GenericSetup/branches/1.2/tool.py 2007-11-23 18:22:34 UTC (rev 81970)
@@ -31,14 +31,12 @@
from interfaces import EXTENSION
from interfaces import ISetupTool
from interfaces import SKIPPED_FILES
-from interfaces import IImportContext
from permissions import ManagePortal
from context import DirectoryImportContext
from context import SnapshotImportContext
from context import TarballExportContext
from context import TarballImportContext
from context import SnapshotExportContext
-from context import BaseContext
from differ import ConfigDiff
from registry import ImportStepRegistry
from registry import ExportStepRegistry
@@ -641,16 +639,8 @@
"""
encoding = self.getEncoding()
- if context_id == '':
- context = BaseContext(self, encoding)
-
- # default is purge
- if should_purge == False:
- context._should_purge = False
-
- return context
-
if context_id.startswith('profile-'):
+
context_id = context_id[len('profile-'):]
info = _profile_registry.getProfileInfo(context_id)
@@ -663,14 +653,12 @@
should_purge = (info.get('type') != EXTENSION)
return DirectoryImportContext(self, path, should_purge, encoding)
- if 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 snapshot
+ context_id = context_id[len('snapshot-'):]
+ if should_purge is None:
+ should_purge = True
+ return SnapshotImportContext(self, context_id, should_purge, encoding)
- raise KeyError, "Context id must be either profile or snapshot (%s)." % context_id
-
security.declarePrivate('_updateImportStepsRegistry')
def _updateImportStepsRegistry(self, context, encoding):
@@ -678,11 +666,6 @@
"""
if context is None:
context = self._getImportContext(self._import_context_id)
-
- # assert that this context provides the import interface
- if not IImportContext.providedBy(context):
- return
-
xml = context.readDataFile(IMPORT_STEPS_XML)
if xml is None:
return
@@ -714,11 +697,6 @@
"""
if context is None:
context = self._getImportContext(self._import_context_id)
-
- # assert that this context provides the import interface
- if not IImportContext.providedBy(context):
- return
-
xml = context.readDataFile(EXPORT_STEPS_XML)
if xml is None:
return
Modified: GenericSetup/branches/1.3/tests/test_tool.py
===================================================================
--- GenericSetup/branches/1.3/tests/test_tool.py 2007-11-23 18:17:05 UTC (rev 81969)
+++ GenericSetup/branches/1.3/tests/test_tool.py 2007-11-23 18:22:34 UTC (rev 81970)
@@ -119,15 +119,6 @@
, 'profile-foo'
)
- def test_setBaselineContext_invalidFormat( self ):
-
- tool = self._makeOne('setup_tool')
-
- self.assertRaises( KeyError
- , tool.setBaselineContext
- , 'profile/default'
- )
-
def test_setBaselineContext( self ):
from Products.GenericSetup.tool import IMPORT_STEPS_XML
@@ -326,7 +317,7 @@
def test_runAllImportSteps_sorted_default_purge( self ):
TITLE = 'original title'
- PROFILE_ID = 'snapshot-testing'
+ PROFILE_ID = 'testing'
site = self._makeSite( TITLE )
tool = self._makeOne('setup_tool').__of__( site )
@@ -364,7 +355,7 @@
def test_runAllImportSteps_unicode_profile_id_creates_reports( self ):
TITLE = 'original title'
- PROFILE_ID = u'snapshot-testing'
+ PROFILE_ID = u'testing'
site = self._makeSite( TITLE )
tool = self._makeOne('setup_tool').__of__( site )
Modified: GenericSetup/branches/1.3/tool.py
===================================================================
--- GenericSetup/branches/1.3/tool.py 2007-11-23 18:17:05 UTC (rev 81969)
+++ GenericSetup/branches/1.3/tool.py 2007-11-23 18:22:34 UTC (rev 81970)
@@ -35,14 +35,12 @@
from interfaces import EXTENSION
from interfaces import ISetupTool
from interfaces import SKIPPED_FILES
-from interfaces import IImportContext
from permissions import ManagePortal
from context import DirectoryImportContext
from context import SnapshotImportContext
from context import TarballExportContext
from context import TarballImportContext
from context import SnapshotExportContext
-from context import BaseContext
from differ import ConfigDiff
from registry import ImportStepRegistry
from registry import ExportStepRegistry
@@ -889,16 +887,8 @@
"""
encoding = self.getEncoding()
- if context_id == '':
- context = BaseContext(self, encoding)
-
- # default is purge
- if should_purge == False:
- context._should_purge = False
-
- return context
-
if context_id.startswith('profile-'):
+
context_id = context_id[len('profile-'):]
info = _profile_registry.getProfileInfo(context_id)
@@ -911,14 +901,12 @@
should_purge = (info.get('type') != EXTENSION)
return DirectoryImportContext(self, path, should_purge, encoding)
- if 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 snapshot
+ context_id = context_id[len('snapshot-'):]
+ if should_purge is None:
+ should_purge = True
+ return SnapshotImportContext(self, context_id, should_purge, encoding)
- raise KeyError, "Context id must be either profile or snapshot (%s)." % context_id
-
security.declarePrivate('_updateImportStepsRegistry')
def _updateImportStepsRegistry(self, context, encoding):
@@ -926,11 +914,6 @@
"""
if context is None:
context = self._getImportContext(self._import_context_id)
-
- # assert that this context provides the import interface
- if not IImportContext.providedBy(context):
- return
-
xml = context.readDataFile(IMPORT_STEPS_XML)
if xml is None:
return
@@ -961,11 +944,6 @@
"""
if context is None:
context = self._getImportContext(self._import_context_id)
-
- # assert that this context provides the import interface
- if not IImportContext.providedBy(context):
- return
-
xml = context.readDataFile(EXPORT_STEPS_XML)
if xml is None:
return
Modified: GenericSetup/trunk/tests/test_tool.py
===================================================================
--- GenericSetup/trunk/tests/test_tool.py 2007-11-23 18:17:05 UTC (rev 81969)
+++ GenericSetup/trunk/tests/test_tool.py 2007-11-23 18:22:34 UTC (rev 81970)
@@ -141,15 +141,6 @@
, 'profile-foo'
)
- def test_setBaselineContext_invalidFormat( self ):
-
- tool = self._makeOne('setup_tool')
-
- self.assertRaises( KeyError
- , tool.setBaselineContext
- , 'profile/default'
- )
-
def test_setBaselineContext( self ):
from Products.GenericSetup.tool import IMPORT_STEPS_XML
@@ -385,7 +376,7 @@
def test_runAllImportSteps_sorted_default_purge( self ):
TITLE = 'original title'
- PROFILE_ID = 'snapshot-testing'
+ PROFILE_ID = 'testing'
site = self._makeSite( TITLE )
tool = self._makeOne('setup_tool').__of__( site )
@@ -423,7 +414,7 @@
def test_runAllImportSteps_unicode_profile_id_creates_reports( self ):
TITLE = 'original title'
- PROFILE_ID = u'snapshot-testing'
+ PROFILE_ID = u'testing'
site = self._makeSite( TITLE )
tool = self._makeOne('setup_tool').__of__( site )
Modified: GenericSetup/trunk/tool.py
===================================================================
--- GenericSetup/trunk/tool.py 2007-11-23 18:17:05 UTC (rev 81969)
+++ GenericSetup/trunk/tool.py 2007-11-23 18:22:34 UTC (rev 81970)
@@ -36,7 +36,6 @@
from interfaces import EXTENSION
from interfaces import ISetupTool
from interfaces import SKIPPED_FILES
-from interfaces import IImportContext
from permissions import ManagePortal
from events import BeforeProfileImportEvent
from events import ProfileImportedEvent
@@ -45,7 +44,6 @@
from context import TarballExportContext
from context import TarballImportContext
from context import SnapshotExportContext
-from context import BaseContext
from differ import ConfigDiff
from registry import ImportStepRegistry
from registry import ExportStepRegistry
@@ -311,11 +309,10 @@
run_dependencies=True, purge_old=None):
""" See ISetupTool.
"""
-
old_context = self._import_context_id
context = self._getImportContext(profile_id, purge_old)
- #self.applyContext(context)
+ self.applyContext(context)
info = self.getImportStepMetadata(step_id)
@@ -943,16 +940,8 @@
"""
encoding = self.getEncoding()
- if context_id == '':
- context = BaseContext(self, encoding)
-
- # default is purge
- if should_purge == False:
- context._should_purge = False
-
- return context
-
if context_id.startswith('profile-'):
+
context_id = context_id[len('profile-'):]
info = _profile_registry.getProfileInfo(context_id)
@@ -965,14 +954,12 @@
should_purge = (info.get('type') != EXTENSION)
return DirectoryImportContext(self, path, should_purge, encoding)
- if 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 snapshot
+ context_id = context_id[len('snapshot-'):]
+ if should_purge is None:
+ should_purge = True
+ return SnapshotImportContext(self, context_id, should_purge, encoding)
- raise KeyError, "Context id must be either profile or snapshot (%s)." % context_id
-
security.declarePrivate('_updateImportStepsRegistry')
def _updateImportStepsRegistry(self, context, encoding):
@@ -980,11 +967,6 @@
"""
if context is None:
context = self._getImportContext(self._import_context_id)
-
- # assert that this context provides the import interface
- if not IImportContext.providedBy(context):
- return
-
xml = context.readDataFile(IMPORT_STEPS_XML)
if xml is None:
return
@@ -1015,11 +997,6 @@
"""
if context is None:
context = self._getImportContext(self._import_context_id)
-
- # assert that this context provides the import interface
- if not IImportContext.providedBy(context):
- return
-
xml = context.readDataFile(EXPORT_STEPS_XML)
if xml is None:
return
More information about the Checkins
mailing list