[CMF-checkins] CVS: CMF/CMFSetup - context.py:1.6 tool.py:1.9
Tres Seaver
tseaver at zope.com
Mon May 24 15:13:40 EDT 2004
Update of /cvs-repository/CMF/CMFSetup
In directory cvs.zope.org:/tmp/cvs-serv13420
Modified Files:
context.py tool.py
Log Message:
- context.py:
o Add APIs for getting the snapshot Folder and its URL.
o Ensure that we don't choke on unicode XML.
o Fux big in ID of nested folder.
- tool.py:
o Implement 'createSnapshot'.
=== CMF/CMFSetup/context.py 1.5 => 1.6 ===
--- CMF/CMFSetup/context.py:1.5 Mon May 24 14:46:54 2004
+++ CMF/CMFSetup/context.py Mon May 24 15:13:09 2004
@@ -215,8 +215,8 @@
def __init__( self, tool, snapshot_id ):
- self._tool = aq_inner( tool )
- self._site = aq_parent( self._tool )
+ self._tool = tool = aq_inner( tool )
+ self._site = aq_parent( tool )
self._snapshot_id = snapshot_id
security.declareProtected( ManagePortal, 'getSite' )
@@ -237,6 +237,20 @@
ob = self._createObjectByType( filename, text, content_type )
folder._setObject( filename, ob )
+ security.declareProtected( ManagePortal, 'getSnapshotURL' )
+ def getSnapshotURL( self ):
+
+ """ See IExportContext.
+ """
+ return '%s/%s' % ( self._tool.absolute_url(), self._snapshot_id )
+
+ security.declareProtected( ManagePortal, 'getSnapshotFolder' )
+ def getSnapshotFolder( self ):
+
+ """ See IExportContext.
+ """
+ return self._ensureSnapshotsFolder()
+
#
# Helper methods
#
@@ -255,7 +269,8 @@
elif content_type in ('text/html', 'text/xml' ):
- ob = ZopePageTemplate( name, body, content_type=content_type )
+ ob = ZopePageTemplate( name, str( body )
+ , content_type=content_type )
elif content_type[:6]=='image/':
@@ -281,7 +296,7 @@
for element in path:
if element not in current.objectIds():
- current._setObject( element, Folder( 'element' ) )
+ current._setObject( element, Folder( element ) )
current = current._getOb( element )
=== CMF/CMFSetup/tool.py 1.8 => 1.9 ===
--- CMF/CMFSetup/tool.py:1.8 Mon May 24 13:48:38 2004
+++ CMF/CMFSetup/tool.py Mon May 24 15:13:09 2004
@@ -16,6 +16,7 @@
from permissions import ManagePortal
from context import ImportContext
from context import TarballExportContext
+from context import SnapshotExportContext
from registry import ImportStepRegistry
from registry import ExportStepRegistry
@@ -178,7 +179,25 @@
""" See ISetupTool.
"""
- raise NotImplementedError
+ context = SnapshotExportContext( self, snapshot_id )
+ messages = {}
+ steps = self._export_registry.listSteps()
+
+ for step_id in steps:
+
+ handler = self._export_registry.getStep( step_id )
+
+ if handler is None:
+ raise ValueError( 'Invalid export step: %s' % step_id )
+
+ messages[ step_id ] = handler( context )
+
+
+ return { 'steps' : steps
+ , 'messages' : messages
+ , 'url' : context.getSnapshotURL()
+ , 'snapshot' : context.getSnapshotFolder()
+ }
security.declareProtected(ManagePortal, 'compareConfigurations')
def compareConfigurations( self
More information about the CMF-checkins
mailing list