[CMF-checkins] SVN: CMF/branches/tseaver-viewification/ Resync again with the trunk since revision 40498.

Tres Seaver tseaver at palladion.com
Thu Dec 15 11:58:32 EST 2005


Log message for revision 40790:
  Resync again with the trunk since revision 40498.

Changed:
  U   CMF/branches/tseaver-viewification/CHANGES.txt
  U   CMF/branches/tseaver-viewification/CMFCalendar/__init__.py
  D   CMF/branches/tseaver-viewification/CMFCalendar/help/
  U   CMF/branches/tseaver-viewification/CMFCore/ActionInformation.py
  U   CMF/branches/tseaver-viewification/CMFCore/TypesTool.py
  U   CMF/branches/tseaver-viewification/CMFCore/__init__.py
  A   CMF/branches/tseaver-viewification/CMFCore/browser/actions.py
  U   CMF/branches/tseaver-viewification/CMFCore/browser/configure.zcml
  U   CMF/branches/tseaver-viewification/CMFCore/browser/typeinfo.py
  U   CMF/branches/tseaver-viewification/CMFCore/configure.zcml
  U   CMF/branches/tseaver-viewification/CMFCore/dtml/cachingPolicies.dtml
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/actions.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/cachingpolicymgr.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/configure.zcml
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/contenttyperegistry.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/cookieauth.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/properties.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/skins.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_actions.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_skins.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_typeinfo.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_workflow.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/typeinfo.py
  U   CMF/branches/tseaver-viewification/CMFCore/exportimport/workflow.py
  U   CMF/branches/tseaver-viewification/CMFCore/tests/base/tidata.py
  U   CMF/branches/tseaver-viewification/CMFCore/tests/test_TypesTool.py
  U   CMF/branches/tseaver-viewification/CMFCore/utils.py
  D   CMF/branches/tseaver-viewification/CMFCore/www/addAction.zpt
  D   CMF/branches/tseaver-viewification/CMFCore/www/addActionCategory.zpt
  U   CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_cut_control.py
  U   CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_paste_control.py
  U   CMF/branches/tseaver-viewification/DCWorkflow/browser/workflow.py
  U   CMF/branches/tseaver-viewification/DCWorkflow/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/MailHost/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/MailHost/exportimport.py
  U   CMF/branches/tseaver-viewification/GenericSetup/OFSP/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/OFSP/exportimport.py
  U   CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/exportimport.py
  U   CMF/branches/tseaver-viewification/GenericSetup/PythonScripts/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/exportimport.py
  U   CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/configure.zcml
  U   CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/exportimport.py
  U   CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/tests/test_exportimport.py
  U   CMF/branches/tseaver-viewification/GenericSetup/browser/utils.py
  U   CMF/branches/tseaver-viewification/GenericSetup/context.py
  U   CMF/branches/tseaver-viewification/GenericSetup/interfaces.py
  U   CMF/branches/tseaver-viewification/GenericSetup/testing.py
  U   CMF/branches/tseaver-viewification/GenericSetup/tests/common.py
  U   CMF/branches/tseaver-viewification/GenericSetup/tests/test_utils.py
  U   CMF/branches/tseaver-viewification/GenericSetup/utils.py

-=-
Modified: CMF/branches/tseaver-viewification/CHANGES.txt
===================================================================
--- CMF/branches/tseaver-viewification/CHANGES.txt	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CHANGES.txt	2005-12-15 16:58:31 UTC (rev 40790)
@@ -45,14 +45,14 @@
 
     - CMFCore and GenericSetup: Added catalog tool setup handlers.
       This includes node adapters for PluginIndexes, ZCTextIndex and ZCatalog.
-      Support for additional indexes can be added by providing INodeExporter
-      and INodeImporter adapters. All indexes are cleared by this handler, so
-      please make sure to re-catalog existing content if necessary.
+      Support for additional indexes can be added by providing INode adapters.
+      All indexes are cleared by this handler, so please make sure to
+      re-catalog existing content if necessary.
 
     - GenericSetup.utils: Added new sub-framework for XML im- and export.
       Instead of using ConfiguratorBase configurators should now implement
-      INodeExporter and INodeImporter. These node adapters should subclass
-      from NodeAdapterBase and mix in ObjectManagerHelpers and / or
+      IBody or INode. These adapters should subclass from XMLAdapterBase or
+      NodeAdapterBase and mix in ObjectManagerHelpers and / or
       PropertyManagerHelpers if needed.
 
     - CMFCore.exportimport:  Added framework and interfaces for exporting
@@ -117,6 +117,10 @@
 
   Bug Fixes
 
+    - PortalFolder: Synced _verifyObjectPaste code with OFS.CopySupport.
+      The behavior is almost the same as before, but the code is less tolerant
+      if content types are not registered properly.
+
     - ActionProviderBase: getActionObject did stumble over newstyle Actions.
 
     - CMFCore.exportimport.content:  Ensure that BODYFILE in our "faux"
@@ -160,6 +164,11 @@
 
   Others
 
+    - TypeInformation: Removed support for old setting formats.
+      If TypeInformation objects are initialized with keyword arguments,
+      'actions' and 'aliases' keys have to use the format introduced in
+      CMF 1.5.
+
     - CMFSetup and GenericSetup: Removed obsolete CMFSetup product.
       Added __module_aliases__ to support setup tools created with CMFSetup. 
 

Modified: CMF/branches/tseaver-viewification/CMFCalendar/__init__.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCalendar/__init__.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCalendar/__init__.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -50,8 +50,6 @@
                    ).initialize( context )
 
     utils.initializeBasesPhase2( z_bases, context )
-    context.registerHelpTitle('CMF Calendar Help')
-    context.registerHelp(directory='help')
     utils.ContentInit( 'CMF Event'
                      , content_types = contentClasses
                      , permission = AddPortalContent

Modified: CMF/branches/tseaver-viewification/CMFCore/ActionInformation.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/ActionInformation.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/ActionInformation.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -16,7 +16,6 @@
 """
 
 from UserDict import UserDict
-from xml.dom.minidom import parseString
 
 from AccessControl import ClassSecurityInfo
 from Acquisition import aq_base, aq_inner, aq_parent
@@ -24,12 +23,8 @@
 from OFS.ObjectManager import IFAwareObjectManager
 from OFS.OrderedFolder import OrderedFolder
 from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.PageTemplateFile import PageTemplateFile
-
 from zope.interface import implements
 
-from Products.GenericSetup.interfaces import INodeImporter
-
 from Expression import Expression
 from interfaces import IAction
 from interfaces import IActionCategory
@@ -53,8 +48,6 @@
     implements(IActionCategory)
     __implements__ = OrderedFolder.__implements__
 
-    meta_type = 'CMF Action Category'
-
     _product_interfaces = (IActionCategory, IAction)
 
     security = ClassSecurityInfo()
@@ -75,19 +68,7 @@
 
 InitializeClass(ActionCategory)
 
-manage_addActionCategoryForm = PageTemplateFile('addActionCategory.zpt',
-                                                _wwwdir)
 
-def manage_addActionCategory(self, id, REQUEST=None):
-    """Add a new CMF Action Category object with ID *id*.
-    """
-    obj = ActionCategory(id)
-    self._setObject(id, obj)
-
-    if REQUEST:
-        return self.manage_main(self, REQUEST, update_menu=1)
-
-
 class Action(SimpleItemWithProperties):
 
     """ Reference to an action.
@@ -95,7 +76,6 @@
 
     implements(IAction)
 
-    meta_type = 'CMF Action'
     i18n_domain = 'cmf_default'
 
     security = ClassSecurityInfo()
@@ -173,85 +153,6 @@
 InitializeClass(Action)
 
 
-def manage_addActionForm(self):
-    """Form for adding a new CMF Action object.
-    """
-    profiles = []
-
-    stool = getToolByName(self, 'portal_setup', None)
-    if stool:
-        for info in stool.listContextInfos():
-            action_paths = []
-            context = stool._getImportContext(info['id'])
-            body = context.readDataFile('actions.xml')
-            if body is None:
-                continue
-            root = parseString(body).documentElement
-            for node in root.childNodes:
-                if node.nodeName != 'object':
-                    continue
-                action_paths += _extractChildren(node)
-            action_paths.sort()
-            profiles.append({'id': info['id'],
-                             'title': info['title'],
-                             'action_paths': tuple(action_paths)})
-
-    template = PageTemplateFile('addAction.zpt', _wwwdir).__of__(self)
-    return template(profiles=tuple(profiles))
-
-def _extractChildren(node):
-    action_paths = []
-    category_id = node.getAttribute('name')
-    for child in node.childNodes:
-        if child.nodeName != 'object':
-            continue
-        if child.getAttribute('meta_type') == Action.meta_type:
-            action_id = child.getAttribute('name')
-            action_paths.append(action_id)
-        else:
-            action_paths += _extractChildren(child)
-    return [ ('%s/%s' % (category_id, path)) for path in action_paths ]
-
-def manage_addAction(self, id, settings_id='', REQUEST=None):
-    """Add a new CMF Action object with ID *id*.
-    """
-    settings_node = None
-    if settings_id:
-        stool = getToolByName(self, 'portal_setup', None)
-        if stool:
-            path = settings_id.split('/')
-            context = stool._getImportContext(path.pop(0))
-            body = context.readDataFile('actions.xml')
-            if body is not None:
-                root = parseString(body).documentElement
-                for node in root.childNodes:
-                    if node.nodeName != 'object':
-                        continue
-                    for obj_id in path:
-                        for child in node.childNodes:
-                            if child.nodeName != 'object':
-                                continue
-                            if child.getAttribute('name') != obj_id:
-                                continue
-                            if child.getAttribute(
-                                             'meta_type') == Action.meta_type:
-                                settings_node = child
-                            else:
-                                node = child
-                            break
-                    if settings_node:
-                        if not id:
-                            id = obj_id
-                        break
-    obj = Action(id)
-    if settings_node:
-        INodeImporter(obj).importNode(settings_node)
-    self._setObject(id, obj)
-
-    if REQUEST:
-        return self.manage_main(self, REQUEST)
-
-
 class ActionInfo(UserDict):
 
     """ A lazy dictionary for Action infos.

Modified: CMF/branches/tseaver-viewification/CMFCore/TypesTool.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/TypesTool.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/TypesTool.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -53,8 +53,6 @@
 from utils import _checkPermission
 from utils import _dtmldir
 from utils import _wwwdir
-from utils import cookString
-from utils import getActionContext
 from utils import getToolByName
 from utils import SimpleItemWithProperties
 from utils import UniqueObject
@@ -128,6 +126,8 @@
     def __init__(self, id, **kw):
 
         self.id = id
+        self._actions = ()
+        self._aliases = {}
 
         if not kw:
             return
@@ -145,21 +145,18 @@
         self.manage_changeProperties(**kw)
 
         actions = kw.get( 'actions', () )
-        # make sure we have a copy
-        _actions = []
         for action in actions:
-            _actions.append( action.copy() )
-        actions = tuple(_actions)
-        # We don't know if actions need conversion, so we always add oldstyle
-        # _actions and convert them.
-        self._actions = actions
-        self._convertActions()
+            self.addAction(
+                  id=action['id']
+                , name=action['title']
+                , action=action['action']
+                , condition=action.get('condition')
+                , permission=action.get( 'permissions', () )
+                , category=action.get('category', 'object')
+                , visible=action.get('visible', True)
+                )
 
-        aliases = kw.get( 'aliases', _marker )
-        if aliases is _marker:
-            self._guessMethodAliases()
-        else:
-            self.setMethodAliases(aliases)
+        self.setMethodAliases(kw.get('aliases', {}))
 
     #
     #   ZMI methods
@@ -270,41 +267,8 @@
     def listActions(self, info=None, object=None):
         """ Return a sequence of the action info objects for this type.
         """
-        if self._actions and isinstance(self._actions[0], dict):
-            self._convertActions()
-
         return self._actions or ()
 
-    security.declarePrivate( '_convertActions' )
-    def _convertActions( self ):
-        """ Upgrade dictionary-based actions.
-        """
-        aa, self._actions = self._actions, ()
-
-        for action in aa:
-
-            # Some backward compatibility stuff.
-            if not 'id' in action:
-                action['id'] = cookString(action['name'])
-
-            if not 'title' in action:
-                action['title'] = action.get('name', action['id'].capitalize())
-
-            # historically, action['action'] is simple string
-            actiontext = action.get('action').strip() or 'string:${object_url}'
-            if actiontext[:7] not in ('python:', 'string:'):
-                actiontext = 'string:${object_url}/%s' % actiontext
-
-            self.addAction(
-                  id=action['id']
-                , name=action['title']
-                , action=actiontext
-                , condition=action.get('condition')
-                , permission=action.get( 'permissions', () )
-                , category=action.get('category', 'object')
-                , visible=action.get('visible', True)
-                )
-
     security.declarePublic('constructInstance')
     def constructInstance(self, container, id, *args, **kw):
         """Build an instance of the type.
@@ -338,8 +302,6 @@
     def getMethodAliases(self):
         """ Get method aliases dict.
         """
-        if not hasattr(self, '_aliases'):
-            self._guessMethodAliases()
         aliases = self._aliases
         # for aliases created with CMF 1.5.0beta
         for key, method_id in aliases.items():
@@ -367,8 +329,6 @@
     def queryMethodID(self, alias, default=None, context=None):
         """ Query method ID by alias.
         """
-        if not hasattr(self, '_aliases'):
-            self._guessMethodAliases()
         aliases = self._aliases
         method_id = aliases.get(alias, default)
         # for aliases created with CMF 1.5.0beta
@@ -376,75 +336,6 @@
             method_id = method_id[0]
         return method_id
 
-    security.declarePrivate('_guessMethodAliases')
-    def _guessMethodAliases(self):
-        """ Guess and set Method Aliases. Used for upgrading old TIs.
-        """
-        context = getActionContext(self)
-        actions = self.listActions()
-        ordered = []
-        _dict = {}
-        viewmethod = ''
-
-        # order actions and search 'mkdir' action
-        for action in actions:
-            if action.getId() == 'view':
-                ordered.insert(0, action)
-            elif action.getId() == 'mkdir':
-                try:
-                    mkdirmethod = action.action(context).strip()
-                except AttributeError:
-                    continue
-                if mkdirmethod.startswith('/'):
-                    mkdirmethod = mkdirmethod[1:]
-                _dict['mkdir'] = mkdirmethod
-            else:
-                ordered.append(action)
-
-        # search 'view' action
-        for action in ordered:
-            perms = action.getPermissions()
-            if not perms or View in perms:
-                try:
-                    viewmethod = action.action(context).strip()
-                except (AttributeError, TypeError):
-                    break
-                if viewmethod.startswith('/'):
-                    viewmethod = viewmethod[1:]
-                if not viewmethod:
-                    viewmethod = '(Default)'
-                break
-        else:
-            viewmethod = '(Default)'
-        if viewmethod:
-            _dict['view'] = viewmethod
-
-        # search default action
-        for action in ordered:
-            try:
-                defmethod = action.action(context).strip()
-            except (AttributeError, TypeError):
-                break
-            if defmethod.startswith('/'):
-                defmethod = defmethod[1:]
-            if not defmethod:
-                break
-        else:
-            if viewmethod:
-                _dict['(Default)'] = viewmethod
-
-        # correct guessed values if we know better
-        if self.content_meta_type in ('Portal File', 'Portal Folder',
-                                      'Portal Image'):
-            _dict['(Default)'] = 'index_html'
-            if viewmethod == '(Default)':
-                _dict['view'] = 'index_html'
-        if self.content_meta_type in ('Document', 'News Item'):
-            _dict['gethtml'] = 'source_html'
-
-        self.setMethodAliases(_dict)
-        return 1
-
 InitializeClass( TypeInformation )
 
 

Modified: CMF/branches/tseaver-viewification/CMFCore/__init__.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/__init__.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/__init__.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -34,10 +34,7 @@
 import CMFBTreeFolder
 import utils
 
-from interfaces import IAction
-from interfaces import IActionCategory
 from permissions import AddPortalFolders
-from permissions import ManagePortal
 
 
 bases = (
@@ -124,24 +121,10 @@
         icon = 'images/registry.gif'
         )
 
-    context.registerClass(
-        ActionInformation.ActionCategory,
-        permission=ManagePortal,
-        constructors=(ActionInformation.manage_addActionCategoryForm,
-                      ActionInformation.manage_addActionCategory),
-        icon='images/cmf_action_category.gif',
-        visibility=None,
-        interfaces=(IActionCategory,))
-
-    context.registerClass(
-        ActionInformation.Action,
-        permission=ManagePortal,
-        constructors=(ActionInformation.manage_addActionForm,
-                      ActionInformation.manage_addAction),
-        icon='images/cmf_action.gif',
-        visibility=None,
-        interfaces=(IAction,))
-
+    utils.registerIcon(ActionInformation.ActionCategory,
+                       'images/cmf_action_category.gif', globals())
+    utils.registerIcon(ActionInformation.Action,
+                       'images/cmf_action.gif', globals())
     utils.registerIcon(TypesTool.FactoryTypeInformation,
                        'images/typeinfo.gif', globals())
     utils.registerIcon(TypesTool.ScriptableTypeInformation,

Copied: CMF/branches/tseaver-viewification/CMFCore/browser/actions.py (from rev 40789, CMF/trunk/CMFCore/browser/actions.py)

Modified: CMF/branches/tseaver-viewification/CMFCore/browser/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/browser/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/browser/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -5,14 +5,34 @@
     i18n_domain="cmf"
     >
 
-  <five:traversable class="Products.CMFCore.WorkflowTool.WorkflowTool"/>
+  <five:traversable class="Products.CMFCore.ActionInformation.ActionCategory"/>
 
+  <five:traversable class="Products.CMFCore.ActionsTool.ActionsTool"/>
+
   <five:traversable class="Products.CMFCore.TypesTool.TypesTool"/>
 
+  <five:traversable class="Products.CMFCore.WorkflowTool.WorkflowTool"/>
+
   <configure package="Products.GenericSetup.browser">
 
     <browser:page
         for="zope.app.container.interfaces.IAdding"
+        name="addAction.html"
+        template="addWithPresettings.pt"
+        class="Products.CMFCore.browser.actions.ActionAddView"
+        permission="cmf.ManagePortal"
+        />
+
+    <browser:page
+        for="zope.app.container.interfaces.IAdding"
+        name="addActionCategory.html"
+        template="addWithPresettings.pt"
+        class="Products.CMFCore.browser.actions.ActionCategoryAddView"
+        permission="cmf.ManagePortal"
+        />
+
+    <browser:page
+        for="zope.app.container.interfaces.IAdding"
         name="addFactoryTypeInformation.html"
         template="addWithPresettings.pt"
         class="Products.CMFCore.browser.typeinfo.FactoryTypeInformationAddView"

Modified: CMF/branches/tseaver-viewification/CMFCore/browser/typeinfo.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/browser/typeinfo.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/browser/typeinfo.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -63,7 +63,7 @@
                                  'obj_ids': tuple(obj_ids)})
         return tuple(profiles)
 
-    def _initSettings(self, obj, profile_id, obj_id):
+    def _initSettings(self, obj, profile_id, obj_path):
         stool = getToolByName(self, 'portal_setup', None)
         if stool is None:
             return
@@ -80,7 +80,7 @@
             new_id = root.getAttribute('name')
             if not new_id:
                 new_id = root.getAttribute('id')
-            if new_id != obj_id:
+            if new_id != obj_path[0]:
                 continue
 
             if root.getAttribute('meta_type') != self.klass.meta_type:

Modified: CMF/branches/tseaver-viewification/CMFCore/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -8,6 +8,22 @@
   <include package=".exportimport"/>
 
   <five:registerClass
+      class=".ActionInformation.ActionCategory"
+      meta_type="CMF Action Category"
+      addview="addActionCategory.html"
+      permission="cmf.ManagePortal"
+      global="False"
+      />
+
+  <five:registerClass
+      class=".ActionInformation.Action"
+      meta_type="CMF Action"
+      addview="addAction.html"
+      permission="cmf.ManagePortal"
+      global="False"
+      />
+
+  <five:registerClass
       class=".TypesTool.FactoryTypeInformation"
       meta_type="Factory-based Type Information"
       addview="addFactoryTypeInformation.html"

Modified: CMF/branches/tseaver-viewification/CMFCore/dtml/cachingPolicies.dtml
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/dtml/cachingPolicies.dtml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/dtml/cachingPolicies.dtml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -26,8 +26,8 @@
                 e304_checked="getEnable304s() and 'checked' or ''"
                 s_max_age_secs="getSMaxAgeSecs() is not None and getSMaxAgeSecs() or ''"
                 last_modified_checked="getLastModified() and 'checked' or ''"
-                pre_check="test(getPreCheck() is None, '', getPreCheck())"
-                post_check="test(getPostCheck() is None, '', getPostCheck())">
+                pre_check="getPreCheck() is not None and getPreCheck() or ''"
+                post_check="getPostCheck() is not None and getPostCheck() or ''">
 
        <input type="hidden" name="policy_id" value="&dtml-getPolicyId;">
        <input type="hidden" name="no_cache:default:int" value="0">

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/actions.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/actions.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/actions.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -18,7 +18,6 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE, UPDATE
 from Products.GenericSetup.utils import I18NURI
 from Products.GenericSetup.utils import NodeAdapterBase
 from Products.GenericSetup.utils import ObjectManagerHelpers
@@ -45,26 +44,30 @@
 
     __used_for__ = IActionCategory
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
         node.appendChild(self._extractObjects())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        purge = self.environ.shouldPurge()
+        if node.getAttribute('purge'):
+            purge = self._convertToBoolean(node.getAttribute('purge'))
+        if purge:
             self._purgeProperties()
             self._purgeObjects()
 
-        self._initProperties(node, mode)
-        self._initObjects(node, mode)
+        self._initProperties(node)
+        self._initObjects(node)
 
+    node = property(_exportNode, _importNode)
 
+
 class ActionNodeAdapter(NodeAdapterBase, PropertyManagerHelpers):
 
     """Node im- and exporter for Action.
@@ -72,23 +75,27 @@
 
     __used_for__ = IAction
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        purge = self.environ.shouldPurge()
+        if node.getAttribute('purge'):
+            purge = self._convertToBoolean(node.getAttribute('purge'))
+        if purge:
             self._purgeProperties()
 
-        self._initProperties(node, mode)
+        self._initProperties(node)
 
+    node = property(_exportNode, _importNode)
 
+
 class ActionsToolXMLAdapter(XMLAdapterBase, ObjectManagerHelpers):
 
     """XML im- and exporter for ActionsTool.
@@ -98,10 +105,9 @@
 
     _LOGGER_ID = 'actions'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.setAttribute('xmlns:i18n', I18NURI)
         node.appendChild(self._extractProviders())
@@ -110,15 +116,15 @@
         self._logger.info('Actions tool exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProviders()
             self._purgeObjects()
 
-        self._initObjects(node, mode)
-        self._initProviders(node, mode)
+        self._initObjects(node)
+        self._initProviders(node)
 
         self._logger.info('Actions tool imported.')
 
@@ -170,7 +176,7 @@
         for provider_id in self.context.listActionProviders():
             self.context.deleteActionProvider(provider_id)
 
-    def _initProviders(self, node, mode):
+    def _initProviders(self, node):
         for child in node.childNodes:
             if child.nodeName != 'action-provider':
                 continue
@@ -189,9 +195,9 @@
                 self.context.addActionProvider(provider_id)
 
             # BBB: for CMF 1.5 profiles
-            self._initOldstyleActions(child, mode)
+            self._initOldstyleActions(child)
 
-    def _initOldstyleActions(self, node, mode):
+    def _initOldstyleActions(self, node):
         # BBB: for CMF 1.5 profiles
         doc = node.ownerDocument
         fragment = doc.createDocumentFragment()
@@ -204,11 +210,13 @@
                 newnode = doc.createElement('object')
                 newnode.setAttribute('name', str(category_id))
                 newnode.setAttribute('meta_type', 'CMF Action Category')
+                newnode.setAttribute('purge', 'False')
                 parent.appendChild(newnode)
                 parent = newnode
             newnode = doc.createElement('object')
             newnode.setAttribute('name', str(child.getAttribute('action_id')))
             newnode.setAttribute('meta_type', 'CMF Action')
+            newnode.setAttribute('purge', 'False')
 
             mapping = {'title': 'title',
                        'url_expr': 'url_expr',
@@ -232,7 +240,7 @@
 
             parent.appendChild(newnode)
 
-        self._initObjects(fragment, UPDATE)
+        self._initObjects(fragment)
 
 
 def importActionProviders(context):

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/cachingpolicymgr.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/cachingpolicymgr.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/cachingpolicymgr.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -18,9 +18,7 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import INodeExporter
-from Products.GenericSetup.interfaces import INodeImporter
-from Products.GenericSetup.interfaces import PURGE
+from Products.GenericSetup.interfaces import INode
 from Products.GenericSetup.utils import NodeAdapterBase
 from Products.GenericSetup.utils import XMLAdapterBase
 
@@ -38,10 +36,9 @@
 
     __used_for__ = ICachingPolicy
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         obj = self.context
         node = self._doc.createElement('caching-policy')
         node.setAttribute('name', obj.getPolicyId())
@@ -72,7 +69,7 @@
             node.setAttribute('post_check', str(post_check))
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         info = {}
@@ -113,7 +110,9 @@
             info['post_check'] = int(post_check)
         self.context.__init__(**info)
 
+    node = property(_exportNode, _importNode)
 
+
 class CachingPolicyManagerXMLAdapter(XMLAdapterBase):
 
     """XML im- and exporter for CachingPolicyManager.
@@ -123,39 +122,37 @@
 
     _LOGGER_ID = 'cachingpolicies'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractCachingPolicies())
 
         self._logger.info('Caching policy manager exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeCachingPolicies()
 
-        self._initCachingPolicies(node, mode)
+        self._initCachingPolicies(node)
 
         self._logger.info('Caching policy manager imported.')
 
     def _extractCachingPolicies(self):
         fragment = self._doc.createDocumentFragment()
         for policy_id, policy in self.context.listPolicies():
-            exporter = INodeExporter(policy, None)
-            if exporter is None:
-                continue
-            fragment.appendChild(exporter.exportNode(self._doc))
+            exporter = zapi.queryMultiAdapter((policy, self.environ), INode)
+            if exporter:
+                fragment.appendChild(exporter.node)
         return fragment
 
     def _purgeCachingPolicies(self):
         self.context.__init__()
 
-    def _initCachingPolicies(self, node, mode):
+    def _initCachingPolicies(self, node):
         for child in node.childNodes:
             if child.nodeName != 'caching-policy':
                 continue
@@ -167,7 +164,9 @@
                                  0, 0, 0, 0, '', '')
 
             policy = self.context._policies[policy_id]
-            INodeImporter(policy).importNode(child, mode)
+            importer = zapi.queryMultiAdapter((policy, self.environ), INode)
+            if importer:
+                importer.node = child
 
 
 def importCachingPolicyManager(context):

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -4,52 +4,37 @@
 
   <adapter
       factory=".actions.ActionCategoryNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.CMFCore.interfaces.IActionCategory"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.CMFCore.interfaces.IActionCategory
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".actions.ActionCategoryNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.CMFCore.interfaces.IActionCategory"
-      />
-
-  <adapter
       factory=".actions.ActionNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.CMFCore.interfaces.IAction"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.CMFCore.interfaces.IAction
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".actions.ActionNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.CMFCore.interfaces.IAction"
-      />
-
-  <adapter
       factory=".actions.ActionsToolXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.IActionsTool
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".cachingpolicymgr.CachingPolicyNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.CMFCore.interfaces.ICachingPolicy"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.CMFCore.interfaces.ICachingPolicy
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".cachingpolicymgr.CachingPolicyNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.CMFCore.interfaces.ICachingPolicy"
-      />
-
-  <adapter
       factory=".cachingpolicymgr.CachingPolicyManagerXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.ICachingPolicyManager
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
@@ -68,61 +53,56 @@
       factory=".contenttyperegistry.ContentTypeRegistryXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.IContentTypeRegistry
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".cookieauth.CookieCrumblerXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.ICookieCrumbler
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".properties.PropertiesXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.ISiteRoot
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".skins.DirectoryViewNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.CMFCore.interfaces.IDirectoryView"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.CMFCore.interfaces.IDirectoryView
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".skins.DirectoryViewNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.CMFCore.interfaces.IDirectoryView"
-      />
-
-  <adapter
       factory=".skins.SkinsToolXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.ISkinsTool
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".typeinfo.TypeInformationXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.ITypeInformation
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".typeinfo.TypesToolXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.ITypesTool
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".workflow.WorkflowToolXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.IWorkflowTool
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
 </configure>

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/contenttyperegistry.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/contenttyperegistry.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/contenttyperegistry.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -18,7 +18,6 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import XMLAdapterBase
 
 from Products.CMFCore.interfaces import IContentTypeRegistry
@@ -36,23 +35,22 @@
 
     _LOGGER_ID = 'contenttypes'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractPredicates())
 
         self._logger.info('Content type registry exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgePredicates()
 
-        self._initPredicates(node, mode)
+        self._initPredicates(node)
 
         self._logger.info('Content type registry imported.')
 
@@ -73,7 +71,7 @@
     def _purgePredicates(self):
         self.context.__init__()
 
-    def _initPredicates(self, node, mode):
+    def _initPredicates(self, node):
         for child in node.childNodes:
             if child.nodeName != 'predicate':
                 continue

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/cookieauth.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/cookieauth.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/cookieauth.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -18,7 +18,6 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import PropertyManagerHelpers
 from Products.GenericSetup.utils import XMLAdapterBase
 
@@ -37,23 +36,22 @@
 
     _LOGGER_ID = 'cookies'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
 
         self._logger.info('Cookie crumbler exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
 
-        self._initProperties(node, mode)
+        self._initProperties(node)
 
         self._logger.info('Cookie crumbler imported.')
 

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/properties.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/properties.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/properties.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -18,7 +18,6 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import PropertyManagerHelpers
 from Products.GenericSetup.utils import XMLAdapterBase
 
@@ -36,23 +35,22 @@
 
     _LOGGER_ID = 'properties'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._doc.createElement('site')
         node.appendChild(self._extractProperties())
 
         self._logger.info('Site properties exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
 
-        self._initProperties(node, mode)
+        self._initProperties(node)
 
         self._logger.info('Site properties imported.')
 

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/skins.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/skins.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/skins.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -15,10 +15,11 @@
 $Id$
 """
 
+from Acquisition import aq_inner
+from Acquisition import aq_parent
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import exportObjects
 from Products.GenericSetup.utils import importObjects
 from Products.GenericSetup.utils import NodeAdapterBase
@@ -40,20 +41,21 @@
 
     __used_for__ = IDirectoryView
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.setAttribute('directory', self.context.getDirPath())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         self.context.manage_properties(str(node.getAttribute('directory')))
 
+    node = property(_exportNode, _importNode)
 
+
 class SkinsToolXMLAdapter(XMLAdapterBase, ObjectManagerHelpers):
 
     """XML im- and exporter for SkinsTool.
@@ -63,10 +65,9 @@
 
     _LOGGER_ID = 'skins'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.setAttribute('default_skin', self.context.default_skin)
         node.setAttribute('request_varname', self.context.request_varname)
@@ -79,12 +80,12 @@
         self._logger.info('Skins tool exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         obj = self.context
 
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             obj.default_skin = ''
             obj.request_varname = 'portal_skin'
             obj.allow_any = 0
@@ -102,13 +103,13 @@
         if node.hasAttribute('cookie_persistence'):
             persistence = node.getAttribute('cookie_persistence')
             obj.cookie_persistence = int(self._convertToBoolean(persistence))
-        self._initObjects(node, mode)
-        self._initBBBObjects(node, mode)
-        self._initSkinPaths(node, mode)
+        self._initObjects(node)
+        self._initBBBObjects(node)
+        self._initSkinPaths(node)
 
         self._logger.info('Skins tool imported.')
 
-    def _initBBBObjects(self, node, mode):
+    def _initBBBObjects(self, node):
         for child in node.childNodes:
             if child.nodeName != 'skin-directory':
                 continue
@@ -134,7 +135,7 @@
     def _purgeSkinPaths(self):
         self.context._getSelections().clear()
 
-    def _initSkinPaths(self, node, mode):
+    def _initSkinPaths(self, node):
         for child in node.childNodes:
             if child.nodeName != 'skin-path':
                 continue
@@ -157,13 +158,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 = self.environ.getSite()
-        request = getattr(site, 'REQUEST', None)
-        if request is not None:
-            site.clearCurrentSkin()
-            site.setupCurrentSkin(request)
+        request = getattr(self.context, 'REQUEST', None)
+        skinnable = aq_parent(aq_inner(self.context))
+        if request is not None and skinnable is not None:
+            skinnable.clearCurrentSkin()
+            skinnable.setupCurrentSkin(request)
 
-
     def _updatePath(self, path, node):
         path = [ name.strip() for name in path.split(',') if name.strip() ]
 

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_actions.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_actions.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_actions.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -17,8 +17,6 @@
 
 import unittest
 import Testing
-import Zope2
-Zope2.startup()
 
 import Products
 from Acquisition import Implicit
@@ -274,11 +272,11 @@
         self.assertEqual(obj.visible, True)
 
     def setUp(self):
-        import Products.CMFCore.exportimport
+        import Products.CMFCore
         from Products.CMFCore.ActionInformation import Action
 
         NodeAdapterTestCase.setUp(self)
-        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
+        zcml.load_config('configure.zcml', Products.CMFCore)
 
         self._obj = Action('foo_action')
         self._XML = _ACTION_XML
@@ -302,11 +300,11 @@
         self.assertEqual(obj.title, '')
 
     def setUp(self):
-        import Products.CMFCore.exportimport
+        import Products.CMFCore
         from Products.CMFCore.ActionInformation import ActionCategory
 
         NodeAdapterTestCase.setUp(self)
-        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
+        zcml.load_config('configure.zcml', Products.CMFCore)
 
         self._obj = ActionCategory('foo_category')
         self._XML = _ACTIONCATEGORY_XML
@@ -336,11 +334,11 @@
         self.assertEqual(obj.action_providers[0], 'portal_actions')
 
     def setUp(self):
-        import Products.CMFCore.exportimport
+        import Products.CMFCore
         from Products.CMFCore.ActionsTool import ActionsTool
 
         BodyAdapterTestCase.setUp(self)
-        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
+        zcml.load_config('configure.zcml', Products.CMFCore)
 
         site = DummySite('site')
         site._setObject('portal_actions', ActionsTool('portal_actions'))
@@ -390,7 +388,8 @@
         PlacelessSetup.setUp(self)
         BaseRegistryTests.setUp(self)
         zcml.load_config('meta.zcml', Products.Five)
-        zcml.load_config('configure.zcml', Products.CMFCore.exportimport)
+        zcml.load_config('permissions.zcml', Products.Five)
+        zcml.load_config('configure.zcml', Products.CMFCore)
 
     def tearDown(self):
         BaseRegistryTests.tearDown(self)

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_skins.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_skins.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_skins.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -331,7 +331,8 @@
         site = DummySite()
         fsdvs = [ (id, DirectoryView(id, 'CMFCore/exportimport/tests/%s' %
                                          id)) for id in ids ]
-        site.portal_skins = DummySkinsTool(selections, fsdvs)
+        site._setObject('portal_skins', DummySkinsTool(selections, fsdvs))
+        site.REQUEST = 'exists'
         return site
 
     def setUp(self):

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_typeinfo.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_typeinfo.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_typeinfo.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -84,17 +84,17 @@
                 'view':      'foo_view',
                 },
     'actions': ({'id':     'view',
-                 'name':   'View',
+                 'title':  'View',
                  'action': 'string:${object_url}/foo_view',
                  'permissions': (View,),
                  },
                 {'id':     'edit',
-                 'name':   'Edit',
+                 'title':  'Edit',
                  'action': 'string:${object_url}/foo_edit_form',
                  'permissions': (ModifyPortalContent,),
                  },
                 {'id':     'metadata',
-                 'name':   'Metadata',
+                 'title':  'Metadata',
                  'action': 'string:${object_url}/metadata_edit_form',
                  'permissions': (ModifyPortalContent,),
                  },
@@ -116,22 +116,22 @@
                 'view':      'bar_view',
                 },
     'actions': ({'id':     'view',
-                 'name':   'View',
+                 'title':  'View',
                  'action': 'string:${object_url}/bar_view',
                  'permissions': (View,),
                  },
                 {'id':     'edit',
-                 'name':   'Edit',
+                 'title':  'Edit',
                  'action': 'string:${object_url}/bar_edit_form',
                  'permissions': (ModifyPortalContent,),
                  },
                 {'id':     'contents',
-                 'name':   'Contents',
+                 'title':  'Contents',
                  'action': 'string:${object_url}/folder_contents',
                  'permissions': (AccessContentsInformation,),
                  },
                 {'id':     'metadata',
-                 'name':   'Metadata',
+                 'title':  'Metadata',
                  'action': 'string:${object_url}/metadata_edit_form',
                  'permissions': (ModifyPortalContent,),
                  },
@@ -396,6 +396,7 @@
         return TypeInformationXMLAdapter
 
     def _populate(self, obj):
+        obj.setMethodAliases({'(Default)': 'foo', 'view': 'foo'})
         obj.addAction('foo_action', 'Foo', 'string:${object_url}/foo',
                       'python:1', (), 'Bar')
 

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_workflow.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_workflow.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/tests/test_workflow.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -51,7 +51,7 @@
       factory="Products.CMFCore.exportimport.tests.test_workflow.DummyWorkflowBodyAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.CMFCore.interfaces.IWorkflowDefinition
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 </configure>
 """
@@ -185,7 +185,7 @@
 
 class DummyWorkflowBodyAdapter(BodyAdapterBase):
 
-    pass
+    body = property(BodyAdapterBase._exportBody, BodyAdapterBase._importBody)
 
 
 class WorkflowToolXMLAdapterTests(BodyAdapterTestCase):

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/typeinfo.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/typeinfo.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/typeinfo.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -21,7 +21,6 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import exportObjects
 from Products.GenericSetup.utils import I18NURI
 from Products.GenericSetup.utils import importObjects
@@ -45,10 +44,9 @@
 
     _LOGGER_ID = 'types'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.setAttribute('xmlns:i18n', I18NURI)
         node.appendChild(self._extractProperties())
@@ -58,18 +56,18 @@
         self._logger.info('%r type info exported.' % self.context.getId())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
             self._purgeAliases()
             self._purgeActions()
 
-        self._initOldstyleProperties(node, mode)
-        self._initProperties(node, mode)
-        self._initAliases(node, mode)
-        self._initActions(node, mode)
+        self._initOldstyleProperties(node)
+        self._initProperties(node)
+        self._initAliases(node)
+        self._initActions(node)
 
         self._logger.info('%r type info imported.' % self.context.getId())
 
@@ -87,7 +85,7 @@
     def _purgeAliases(self):
         self.context.setMethodAliases({})
 
-    def _initAliases(self, node, mode):
+    def _initAliases(self, node):
         aliases = self.context.getMethodAliases()
         for child in node.childNodes:
             # BBB: for CMF 1.5 profiles
@@ -129,7 +127,7 @@
     def _purgeActions(self):
         self.context._actions = ()
 
-    def _initActions(self, node, mode):
+    def _initActions(self, node):
         for child in node.childNodes:
             if child.nodeName != 'action':
                 continue
@@ -152,7 +150,7 @@
             self.context.addAction(id, title, action, condition,
                                    tuple(permissions), category, visible)
 
-    def _initOldstyleProperties(self, node, mode):
+    def _initOldstyleProperties(self, node):
         if not node.hasAttribute('title'):
             return
         # BBB: for CMF 1.5 profiles
@@ -207,10 +205,9 @@
 
     _LOGGER_ID = 'types'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
         node.appendChild(self._extractObjects())
@@ -218,20 +215,20 @@
         self._logger.info('Types tool exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
             self._purgeObjects()
 
-        self._initProperties(node, mode)
-        self._initObjects(node, mode)
-        self._initBBBObjects(node, mode)
+        self._initProperties(node)
+        self._initObjects(node)
+        self._initBBBObjects(node)
 
         self._logger.info('Types tool imported.')
 
-    def _initBBBObjects(self, node, mode):
+    def _initBBBObjects(self, node):
         for child in node.childNodes:
             if child.nodeName != 'type':
                 continue
@@ -242,6 +239,7 @@
                 filename = str(child.getAttribute('filename'))
                 if not filename:
                     filename = 'types/%s.xml' % obj_id.replace(' ', '_')
+                # cheating here for BBB: readDataFile is no interface method
                 body = self.environ.readDataFile(filename)
                 if body is None:
                     break

Modified: CMF/branches/tseaver-viewification/CMFCore/exportimport/workflow.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/exportimport/workflow.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/exportimport/workflow.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -19,7 +19,6 @@
 from zope.app import zapi
 
 from Products.GenericSetup.interfaces import IBody
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import exportObjects
 from Products.GenericSetup.utils import importObjects
 from Products.GenericSetup.utils import ObjectManagerHelpers
@@ -42,10 +41,9 @@
 
     _LOGGER_ID = 'workflow'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
         node.appendChild(self._extractObjects())
@@ -54,22 +52,22 @@
         self._logger.info('Workflow tool exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
             self._purgeObjects()
             self._purgeChains()
 
-        self._initProperties(node, mode)
-        self._initObjects(node, mode)
-        self._initBBBObjects(node, mode)
-        self._initChains(node, mode)
+        self._initProperties(node)
+        self._initObjects(node)
+        self._initBBBObjects(node)
+        self._initChains(node)
 
         self._logger.info('Workflow tool imported.')
 
-    def _initBBBObjects(self, node, mode):
+    def _initBBBObjects(self, node):
         for child in node.childNodes:
             if child.nodeName != 'workflow':
                 continue
@@ -113,7 +111,7 @@
         if self.context._chains_by_type is not None:
             self.context._chains_by_type.clear()
 
-    def _initChains(self, node, mode):
+    def _initChains(self, node):
         for child in node.childNodes:
             if child.nodeName != 'bindings':
                 continue

Modified: CMF/branches/tseaver-viewification/CMFCore/tests/base/tidata.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/tests/base/tidata.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/tests/base/tidata.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -1,28 +1,31 @@
-ManageProperties = 'Manage properties'
 ModifyPortalContent = 'Modify portal content'
 View = 'View'
 
 FTIDATA_ACTIONS = (
       { 'id' : 'Action Tests'
       , 'meta_type' : 'Dummy'
+      , 'aliases' : {}
       , 'actions' : (
-            { 'id':'view',
+            { 'id': 'view',
               'title': 'View',
               'action':'string:',
               'permissions':('View',),
               'category':'object',
               'visible':1 }
-          , { 'name':'Edit',                    # Note: No ID passed
+          , { 'id': 'edit',
+              'title': 'Edit',
               'action':'string:${object_url}/foo_edit',
               'permissions':('Modify',),
               'category':'object',
               'visible':1 }
-          , { 'name':'Object Properties',       # Note: No ID passed
+          , { 'id': 'objectproperties',
+              'title': 'Object Properties',
               'action':'string:foo_properties',
               'permissions':('Modify',),
               'category':'object',
               'visible':1 }
-          , { 'id':'slot',
+          , { 'id': 'slot',
+              'title': 'Slot',
               'action':'string:foo_slot',
               'category':'object',
               'visible':0 }
@@ -37,6 +40,7 @@
       , 'meta_type' : 'Dummy'
       , 'product' : 'FooProduct'
       , 'factory' : 'addFoo'
+      , 'aliases' : {}
       , 'actions' : (
             { 'id': 'view',
               'title': 'View',
@@ -55,195 +59,6 @@
     ,
     )
 
-FTIDATA_CMF13 = (
-      { 'id' : 'Dummy Content 13'
-      , 'meta_type' : 'Dummy'
-      , 'description' : (
-           'Dummy Content.')
-      , 'icon' : 'dummy_icon.gif'
-      , 'product' : 'FooProduct'
-      , 'factory' : 'addFoo'
-      , 'immediate_view' : 'metadata_edit_form'
-      , 'actions' : (
-            { 'id':'view',
-              'name':'View',
-              'action':'dummy_view',
-              'permissions':(View,) }
-          , { 'id':'edit',
-              'name':'Edit',
-              'action':'dummy_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          , { 'id':'metadata',
-              'name':'Metadata',
-              'action':'metadata_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          )
-      }
-    ,
-    )
-
-FTIDATA_CMF13_FOLDER = (
-      { 'id' : 'Dummy Folder 13'
-      , 'meta_type' : 'Dummy Folder'
-      , 'description' : (
-           'Dummy Folder.')
-      , 'icon' : 'dummy_icon.gif'
-      , 'product' : 'FooProduct'
-      , 'factory' : 'addFoo'
-      , 'filter_content_types' : 0
-      , 'immediate_view' : 'dummy_edit_form'
-      , 'actions' : (
-            { 'id':'view',
-              'name':'View',
-              'action':'',
-              'permissions':(View,),
-              'category':'folder' }
-          , { 'id':'edit',
-              'name':'Edit',
-              'action':'dummy_edit_form',
-              'permissions':(ManageProperties,),
-              'category':'folder' }
-          , { 'id':'localroles',
-              'name':'Local Roles',
-              'action':'folder_localrole_form',
-              'permissions':(ManageProperties,),
-              'category':'folder' }
-          )
-      }
-    ,
-    )
-
-FTIDATA_CMF14 = (
-      { 'id' : 'Dummy Content 14'
-      , 'meta_type' : 'Dummy'
-      , 'description' : (
-           'Dummy Content.')
-      , 'icon' : 'dummy_icon.gif'
-      , 'product' : 'FooProduct'
-      , 'factory' : 'addFoo'
-      , 'immediate_view' : 'metadata_edit_form'
-      , 'actions' : (
-            { 'id':'view',
-              'name':'View',
-              'action':'string:${object_url}/dummy_view',
-              'permissions':(View,) }
-          , { 'id':'edit',
-              'name':'Edit',
-              'action':'string:${object_url}/dummy_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          , { 'id':'metadata',
-              'name':'Metadata',
-              'action':'string:${object_url}/metadata_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          )
-      }
-    ,
-    )
-
-FTIDATA_CMF14_FOLDER = (
-      { 'id' : 'Dummy Folder 14'
-      , 'meta_type' : 'Dummy Folder'
-      , 'description' : (
-           'Dummy Folder.')
-      , 'icon' : 'dummy_icon.gif'
-      , 'product' : 'FooProduct'
-      , 'factory' : 'addFoo'
-      , 'filter_content_types' : 0
-      , 'immediate_view' : 'dummy_edit_form'
-      , 'actions' : (
-            { 'id':'view',
-              'name':'View',
-              'action':'string:${object_url}',
-              'permissions':(View,),
-              'category':'folder' }
-          , { 'id':'edit',
-              'name':'Edit',
-              'action':'string:${object_url}/dummy_edit_form',
-              'permissions':(ManageProperties,),
-              'category':'folder' }
-          , { 'id':'localroles',
-              'name':'Local Roles',
-              'action':'string:${object_url}/folder_localrole_form',
-              'permissions':(ManageProperties,),
-              'category':'folder' }
-          )
-      }
-    ,
-    )
-
-FTIDATA_CMF14_SPECIAL = (
-      { 'id' : 'Dummy Content 14'
-      , 'meta_type' : 'Dummy'
-      , 'description' : (
-           'Dummy Content.')
-      , 'icon' : 'dummy_icon.gif'
-      , 'product' : 'FooProduct'
-      , 'factory' : 'addFoo'
-      , 'immediate_view' : 'metadata_edit_form'
-      , 'actions' : (
-            { 'id':'download',
-              'name':'Download',
-              'action':'string:${object_url}/',   # Note: special default view
-              'permissions':(View,) }
-          , { 'id':'edit',
-              'name':'Edit',
-              'action':'string:${object_url}/dummy_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          , { 'id':'view',                  # Note: not first with 'View' perm
-              'name':'View',
-              'action':'string:${object_url}/dummy_view',
-              'permissions':(View,) }
-          , { 'id':'metadata',
-              'name':'Metadata',
-              'action':'string:${object_url}/metadata_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          , { 'id':'mkdir',
-              'name':'MKDIR handler',
-              'action':'string:dummy_mkdir',
-              'category':'folder',
-              'visible':0 }
-          )
-      }
-    ,
-    )
-
-FTIDATA_CMF14_SPECIAL2 = (
-      { 'id' : 'Dummy Content 14'
-      , 'meta_type' : 'Dummy'
-      , 'description' : (
-           'Dummy Content.')
-      , 'icon' : 'dummy_icon.gif'
-      , 'product' : 'FooProduct'
-      , 'factory' : 'addFoo'
-      , 'immediate_view' : 'metadata_edit_form'
-      , 'actions' : (
-            { 'id': 'top',
-              'name': 'View Mail Archive',
-              'category': 'object',
-              'action':'python:object.getArchive().absolute_url()',
-              'permissions':(View,) }
-          , { 'id':'view',
-              'name':'View',
-              'action':"python:object.someMethod() + '/some_template.html'",
-              'permissions':(View,) }
-          , { 'id':'edit',
-              'name':'Edit',
-              'action':'string:${object_url}/dummy_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          , { 'id':'metadata',
-              'name':'Metadata',
-              'action':'string:${object_url}/metadata_edit_form',
-              'permissions':(ModifyPortalContent,) }
-          , { 'id':'mkdir',
-              'name':'MKDIR handler',
-              'action':'python:object.getMKDIR().absolute_url()',
-              'category':'folder',
-              'visible':0 }
-          )
-      }
-    ,
-    )
-
 FTIDATA_CMF15 = (
       { 'id' : 'Dummy Content 15'
       , 'meta_type' : 'Dummy'

Modified: CMF/branches/tseaver-viewification/CMFCore/tests/test_TypesTool.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/tests/test_TypesTool.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/tests/test_TypesTool.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -43,12 +43,6 @@
 from Products.CMFCore.tests.base.testcase import SecurityTest
 from Products.CMFCore.tests.base.testcase import WarningInterceptor
 from Products.CMFCore.tests.base.tidata import FTIDATA_ACTIONS
-from Products.CMFCore.tests.base.tidata import FTIDATA_CMF13
-from Products.CMFCore.tests.base.tidata import FTIDATA_CMF13_FOLDER
-from Products.CMFCore.tests.base.tidata import FTIDATA_CMF14
-from Products.CMFCore.tests.base.tidata import FTIDATA_CMF14_FOLDER
-from Products.CMFCore.tests.base.tidata import FTIDATA_CMF14_SPECIAL
-from Products.CMFCore.tests.base.tidata import FTIDATA_CMF14_SPECIAL2
 from Products.CMFCore.tests.base.tidata import FTIDATA_CMF15
 from Products.CMFCore.tests.base.tidata import FTIDATA_DUMMY
 from Products.CMFCore.tests.base.tidata import STI_SCRIPT
@@ -300,111 +294,7 @@
         self.assertEqual(ti._actions[1].action.text, wanted_actions_text1)
         self.assertEqual(ti._actions[2].action.text, wanted_actions_text2)
 
-    def test_CMF13_content_migration(self):
 
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF13[0] )
-        self._checkContentTI(ti)
-
-        # simulate old FTI
-        del ti._aliases
-        self.failIf( hasattr(ti, '_aliases') )
-        ti._actions = FTIDATA_CMF13[0]['actions']
-        self.failUnless( isinstance(ti._actions[0], dict) )
-
-        # migrate FTI
-        ti.queryMethodID('view')
-        self._checkContentTI(ti)
-
-    def test_CMF13_folder_migration(self):
-
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF13_FOLDER[0] )
-        self._checkFolderTI(ti)
-
-        # simulate old FTI
-        del ti._aliases
-        self.failIf( hasattr(ti, '_aliases') )
-        ti._actions = FTIDATA_CMF13_FOLDER[0]['actions']
-        self.failUnless( isinstance(ti._actions[0], dict) )
-
-        # migrate FTI
-        ti.queryMethodID('view')
-        self._checkFolderTI(ti)
-
-    def test_CMF14_content_migration(self):
-
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF14[0] )
-        self._checkContentTI(ti)
-
-        # simulate old FTI
-        del ti._aliases
-        self.failIf( hasattr(ti, '_aliases') )
-
-        # migrate FTI
-        ti.queryMethodID('view')
-        self._checkContentTI(ti)
-
-    def test_CMF14_folder_migration(self):
-
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF14_FOLDER[0] )
-        self._checkFolderTI(ti)
-
-        # simulate old FTI
-        del ti._aliases
-        self.failIf( hasattr(ti, '_aliases') )
-
-        # migrate FTI
-        ti.queryMethodID('view')
-        self._checkFolderTI(ti)
-
-    def test_CMF14_special_migration(self):
-        wanted = { 'view': 'dummy_view', 'mkdir': 'dummy_mkdir' }
-
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF14_SPECIAL[0] )
-        self.assertEqual(ti._aliases, wanted)
-
-        # simulate old FTI
-        del ti._aliases
-        self.failIf( hasattr(ti, '_aliases') )
-
-        # migrate FTI
-        ti.queryMethodID('view')
-        self.assertEqual(ti._aliases, wanted)
-
-    def test_CMF14_special2_migration(self):
-        wanted = {}
-
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF14_SPECIAL2[0] )
-        self.assertEqual(ti._aliases, wanted)
-
-        # simulate old FTI
-        del ti._aliases
-        self.failIf( hasattr(ti, '_aliases') )
-
-        # migrate FTI
-        ti.queryMethodID('view')
-        self.assertEqual(ti._aliases, wanted)
-
-    def test_CMF150beta_content_migration(self):
-
-        # use old FTI Data
-        ti = self._makeInstance( **FTIDATA_CMF14[0] )
-        self._checkContentTI(ti)
-
-        # simulate old FTI
-        ti._aliases = { 'view': ('dummy_view',),
-                        '(Default)': ('dummy_view',) }
-
-        # migrate FTI
-        ti.getMethodAliases()
-        self._checkContentTI(ti)
-
-
 class FTIDataTests( TypeInfoTests ):
 
     def _makeInstance(self, id, **kw):

Modified: CMF/branches/tseaver-viewification/CMFCore/utils.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/utils.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/utils.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -44,8 +44,6 @@
 from OFS.PropertyManager import PropertyManager
 from OFS.PropertySheets import PropertySheets
 from OFS.SimpleItem import SimpleItem
-from Products.PageTemplates.Expressions import getEngine
-from Products.PageTemplates.Expressions import SecureModuleImporter
 from thread import allocate_lock
 
 from exceptions import AccessControl_Unauthorized
@@ -154,24 +152,6 @@
 
     return context.user.allowed(obj, roles)
 
-security.declarePublic( 'getActionContext' )
-def getActionContext( self ):
-    # getActionContext is deprecated and will be removed as soon as the
-    # backwards compatibility code in TypeInformation._guessMethodAliases is
-    # removed.
-    data = { 'object_url'   : ''
-           , 'folder_url'   : ''
-           , 'portal_url'   : ''
-           , 'object'       : None
-           , 'folder'       : None
-           , 'portal'       : None
-           , 'nothing'      : None
-           , 'request'      : getattr( self, 'REQUEST', None )
-           , 'modules'      : SecureModuleImporter
-           , 'member'       : None
-           }
-    return getEngine().getContext( data )
-
 # If Zope ever provides a call to getRolesInContext() through
 # the SecurityManager API, the method below needs to be updated.
 security.declarePrivate('_limitGrantedRoles')

Deleted: CMF/branches/tseaver-viewification/CMFCore/www/addAction.zpt
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/www/addAction.zpt	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/www/addAction.zpt	2005-12-15 16:58:31 UTC (rev 40790)
@@ -1,45 +0,0 @@
-<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
-<h2 tal:define="form_title string:Add CMF Action"
-    tal:replace="structure context/manage_form_title">FORM TITLE</h2>
-
-<p class="form-help">An Action object represents a reference to an action.</p>
-
-<form action="manage_addAction" method="post">
-<table cellspacing="0" cellpadding="2" border="0">
- <tr>
-  <td>
-   <div class="form-label">ID</div>
-  </td>
-  <td>
-   <input type="text" name="id" size="40" />
-  </td>
- </tr>
- <tr>
-  <td>
-   <div class="form-label">Presettings</div>
-  </td>
-  <td>
-   <select name="settings_id">
-    <option value="" selected="selected">(None)</option>
-    <optgroup label="PROFILE_TITLE"
-       tal:repeat="profile options/profiles"
-       tal:attributes="label profile/title">
-     <option value="SETTINGS_ID"
-             tal:repeat="action_path profile/action_paths"
-             tal:attributes="value string:${profile/id}/${action_path}"
-             tal:content="action_path">ACTION PATH</option></optgroup>
-   </select>
-  </td>
- </tr>
- <tr>
-  <td>
-   &nbsp;
-  </td>
-  <td>
-   <input class="form-element" type="submit" name="submit" value="Add" /> 
-  </td>
- </tr>
-</table>
-</form>
-
-<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>

Deleted: CMF/branches/tseaver-viewification/CMFCore/www/addActionCategory.zpt
===================================================================
--- CMF/branches/tseaver-viewification/CMFCore/www/addActionCategory.zpt	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFCore/www/addActionCategory.zpt	2005-12-15 16:58:31 UTC (rev 40790)
@@ -1,29 +0,0 @@
-<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1>
-<h2 tal:define="form_title string:Add CMF Action Category"
-    tal:replace="structure context/manage_form_title">FORM TITLE</h2>
-
-<p class="form-help">An Action Category object represents a group of Action
- objects.</p>
-
-<form action="manage_addActionCategory" method="post">
-<table cellspacing="0" cellpadding="2" border="0">
- <tr>
-  <td>
-   <div class="form-label">ID</div>
-  </td>
-  <td>
-   <input type="text" name="id" size="40" />
-  </td>
- </tr>
- <tr>
-  <td>
-   &nbsp;
-  </td>
-  <td>
-   <input class="form-element" type="submit" name="submit" value="Add" /> 
-  </td>
- </tr>
-</table>
-</form>
-
-<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1>

Modified: CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_cut_control.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_cut_control.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_cut_control.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -2,6 +2,7 @@
 ##title=Cut objects from a folder and copy to the clipboard
 ##
 from Products.CMFDefault.exceptions import CopyError
+from Products.CMFDefault.exceptions import zExceptions_Unauthorized
 from Products.CMFDefault.utils import MessageID as _
 
 try:
@@ -12,3 +13,5 @@
         return context.setStatus(True, _('Items cut.'))
 except CopyError:
     return context.setStatus(False, _('CopyError: Cut failed.'))
+except zExceptions_Unauthorized:
+    return context.setStatus(False, _('Unauthorized: Cut failed.'))

Modified: CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_paste_control.py
===================================================================
--- CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_paste_control.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/CMFDefault/skins/zpt_control/folder_paste_control.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -8,7 +8,7 @@
 if context.cb_dataValid:
     try:
         result = context.manage_pasteObjects(context.REQUEST['__cp'])
-        if len(ids) == 1:
+        if len(result) == 1:
             return context.setStatus(True, _('Item pasted.'))
         else:
             return context.setStatus(True, _('Items pasted.'))

Modified: CMF/branches/tseaver-viewification/DCWorkflow/browser/workflow.py
===================================================================
--- CMF/branches/tseaver-viewification/DCWorkflow/browser/workflow.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/DCWorkflow/browser/workflow.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -59,7 +59,7 @@
                                  'obj_ids': tuple(obj_ids)})
         return tuple(profiles)
 
-    def _initSettings(self, obj, profile_id, obj_id):
+    def _initSettings(self, obj, profile_id, obj_path):
         stool = getToolByName(self, 'portal_setup', None)
         if stool is None:
             return
@@ -73,7 +73,7 @@
                 continue
 
             root = parseString(body).documentElement
-            if not root.getAttribute('workflow_id') == obj_id:
+            if not root.getAttribute('workflow_id') == obj_path[0]:
                 continue
 
             importer = zapi.queryMultiAdapter((obj, context), IBody)

Modified: CMF/branches/tseaver-viewification/DCWorkflow/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/DCWorkflow/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/DCWorkflow/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -17,7 +17,7 @@
       factory=".exportimport.DCWorkflowDefinitionBodyAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for=".interfaces.IDCWorkflowDefinition
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
 </configure>

Modified: CMF/branches/tseaver-viewification/GenericSetup/MailHost/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/MailHost/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/MailHost/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -6,7 +6,7 @@
       factory=".exportimport.MailHostXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.MailHost.interfaces.IMailHost
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
 </configure>

Modified: CMF/branches/tseaver-viewification/GenericSetup/MailHost/exportimport.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/MailHost/exportimport.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/MailHost/exportimport.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -15,7 +15,6 @@
 $Id$
 """
 
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import XMLAdapterBase
 
 from Products.MailHost.interfaces import IMailHost
@@ -30,10 +29,9 @@
 
     _LOGGER_ID = 'mailhost'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.setAttribute('smtp_host', str(self.context.smtp_host))
         node.setAttribute('smtp_port', str(self.context.smtp_port))
@@ -43,7 +41,7 @@
         self._logger.info('Mailhost exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         self.context.smtp_host = str(node.getAttribute('smtp_host'))

Modified: CMF/branches/tseaver-viewification/GenericSetup/OFSP/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/OFSP/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/OFSP/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -6,7 +6,7 @@
       factory=".exportimport.FolderXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="OFS.interfaces.IFolder
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
 </configure>

Modified: CMF/branches/tseaver-viewification/GenericSetup/OFSP/exportimport.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/OFSP/exportimport.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/OFSP/exportimport.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -15,7 +15,6 @@
 $Id$
 """
 
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import XMLAdapterBase
 from Products.GenericSetup.utils import ObjectManagerHelpers
 from Products.GenericSetup.utils import PropertyManagerHelpers
@@ -33,10 +32,9 @@
 
     _LOGGER_ID = 'ofs'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
         node.appendChild(self._extractObjects())
@@ -44,15 +42,15 @@
         self._logger.info('Folder exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
             self._purgeObjects()
 
-        self._initProperties(node, mode)
-        self._initObjects(node, mode)
+        self._initProperties(node)
+        self._initObjects(node)
 
         self._logger.info('Folder imported.')
 

Modified: CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -4,86 +4,58 @@
 
   <adapter
       factory=".exportimport.PluggableIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.IPluggableIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.IPluggableIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".exportimport.PluggableIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.PluginIndexes.interfaces.IPluggableIndex"
-      />
-
-  <adapter
       factory=".exportimport.DateIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.IDateIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.IDateIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".exportimport.DateIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.PluginIndexes.interfaces.IDateIndex"
-      />
-
-  <adapter
       factory=".exportimport.DateRangeIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.IDateRangeIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.IDateRangeIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".exportimport.DateRangeIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.PluginIndexes.interfaces.IDateRangeIndex"
-      />
-
-  <adapter
       factory=".exportimport.PathIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.IPathIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.IPathIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".exportimport.PathIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.PluginIndexes.interfaces.IPathIndex"
-      />
-
-  <adapter
       factory=".exportimport.VocabularyNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.IVocabulary"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.IVocabulary
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".exportimport.TextIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.ITextIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.ITextIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
       factory=".exportimport.FilteredSetNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.IFilteredSet"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.IFilteredSet
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".exportimport.FilteredSetNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.PluginIndexes.interfaces.IFilteredSet"
-      />
-
-  <adapter
       factory=".exportimport.TopicIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.PluginIndexes.interfaces.ITopicIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.PluginIndexes.interfaces.ITopicIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
-  <adapter
-      factory=".exportimport.TopicIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.PluginIndexes.interfaces.ITopicIndex"
-      />
-
 </configure>

Modified: CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/exportimport.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/exportimport.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/PluginIndexes/exportimport.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -15,9 +15,9 @@
 $Id$
 """
 
-from Products.GenericSetup.interfaces import INodeExporter
-from Products.GenericSetup.interfaces import INodeImporter
-from Products.GenericSetup.interfaces import PURGE
+from zope.app import zapi
+
+from Products.GenericSetup.interfaces import INode
 from Products.GenericSetup.utils import NodeAdapterBase
 from Products.GenericSetup.utils import PropertyManagerHelpers
 
@@ -38,10 +38,9 @@
 
     __used_for__ = IPluggableIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('index')
         for value in self.context.getIndexSourceNames():
             child = self._doc.createElement('indexed_attr')
@@ -49,7 +48,7 @@
             node.appendChild(child)
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         indexed_attrs = []
@@ -60,7 +59,9 @@
         self.context.indexed_attrs = indexed_attrs
         self.context.clear()
 
+    node = property(_exportNode, _importNode)
 
+
 class DateIndexNodeAdapter(NodeAdapterBase, PropertyManagerHelpers):
 
     """Node im- and exporter for DateIndex.
@@ -68,24 +69,25 @@
 
     __used_for__ = IDateIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('index')
         node.appendChild(self._extractProperties())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
 
-        self._initProperties(node, mode)
+        self._initProperties(node)
         self.context.clear()
 
+    node = property(_exportNode, _importNode)
 
+
 class DateRangeIndexNodeAdapter(NodeAdapterBase):
 
     """Node im- and exporter for DateRangeIndex.
@@ -93,23 +95,24 @@
 
     __used_for__ = IDateRangeIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('index')
         node.setAttribute('since_field', self.context.getSinceField())
         node.setAttribute('until_field', self.context.getUntilField())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         self.context._edit(node.getAttribute('since_field').encode('utf-8'),
                            node.getAttribute('until_field').encode('utf-8'))
         self.context.clear()
 
+    node = property(_exportNode, _importNode)
 
+
 class PathIndexNodeAdapter(NodeAdapterBase):
 
     """Node im- and exporter for PathIndex.
@@ -117,13 +120,14 @@
 
     __used_for__ = IPathIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         return self._getObjectNode('index')
 
+    node = property(_exportNode, NodeAdapterBase._importNode)
 
+
 class VocabularyNodeAdapter(NodeAdapterBase):
 
     """Node im- and exporter for Vocabulary.
@@ -131,15 +135,16 @@
 
     __used_for__ = IVocabulary
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.setAttribute('deprecated', 'True')
         return node
 
+    node = property(_exportNode, NodeAdapterBase._importNode)
 
+
 class TextIndexNodeAdapter(NodeAdapterBase):
 
     """Node im- and exporter for TextIndex.
@@ -147,15 +152,16 @@
 
     __used_for__ = ITextIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('index')
         node.setAttribute('deprecated', 'True')
         return node
 
+    node = property(_exportNode, NodeAdapterBase._importNode)
 
+
 class FilteredSetNodeAdapter(NodeAdapterBase):
 
     """Node im- and exporter for FilteredSet.
@@ -163,22 +169,23 @@
 
     __used_for__ = IFilteredSet
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('filtered_set')
         node.setAttribute('expression', self.context.getExpression())
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         self.context.setExpression(
                               node.getAttribute('expression').encode('utf-8'))
         self.context.clear()
 
+    node = property(_exportNode, _importNode)
 
+
 class TopicIndexNodeAdapter(NodeAdapterBase):
 
     """Node im- and exporter for TopicIndex.
@@ -186,16 +193,16 @@
 
     __used_for__ = ITopicIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('index')
         for set in self.context.filteredSets.values():
-            node.appendChild(INodeExporter(set).exportNode(doc))
+            exporter = zapi.queryMultiAdapter((set, self.environ), INode)
+            node.appendChild(exporter.node)
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         for child in node.childNodes:
@@ -204,5 +211,8 @@
                 set_meta_type = str(child.getAttribute('meta_type'))
                 self.context.addFilteredSet(set_id, set_meta_type, '')
                 set = self.context.filteredSets[set_id]
-                INodeImporter(set).importNode(child)
+                importer = zapi.queryMultiAdapter((set, self.environ), INode)
+                importer.node = child
         self.context.clear()
+
+    node = property(_exportNode, _importNode)

Modified: CMF/branches/tseaver-viewification/GenericSetup/PythonScripts/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/PythonScripts/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/PythonScripts/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -7,7 +7,7 @@
       factory=".exportimport.PythonScriptBodyAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for=".interfaces.IPythonScript
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <five:implements

Modified: CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -4,26 +4,16 @@
 
   <adapter
       factory=".exportimport.ZCLexiconNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.ZCTextIndex.interfaces.IZCLexicon"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.ZCTextIndex.interfaces.IZCLexicon
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
   <adapter
-      factory=".exportimport.ZCLexiconNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.ZCTextIndex.interfaces.IZCLexicon"
-      />
-
-  <adapter
       factory=".exportimport.ZCTextIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeExporter"
-      for="Products.ZCTextIndex.interfaces.IZCTextIndex"
+      provides="Products.GenericSetup.interfaces.INode"
+      for="Products.ZCTextIndex.interfaces.IZCTextIndex
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
-  <adapter
-      factory=".exportimport.ZCTextIndexNodeAdapter"
-      provides="Products.GenericSetup.interfaces.INodeImporter"
-      for="Products.ZCTextIndex.interfaces.IZCTextIndex"
-      />
-
 </configure>

Modified: CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/exportimport.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/exportimport.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/ZCTextIndex/exportimport.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -19,7 +19,6 @@
 from BTrees.Length import Length
 from BTrees.OIBTree import OIBTree
 
-from Products.GenericSetup.interfaces import PURGE
 from Products.GenericSetup.utils import NodeAdapterBase
 
 from Products.ZCTextIndex.interfaces import IZCLexicon
@@ -34,10 +33,9 @@
 
     __used_for__ = IZCLexicon
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         for element in self.context._pipeline:
             group, name = self._getKeys(element)
@@ -47,7 +45,7 @@
             node.appendChild(child)
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         pipeline = []
@@ -63,6 +61,8 @@
         self.context._words = IOBTree()
         self.context.length = Length()
 
+    node = property(_exportNode, _importNode)
+
     def _getKeys(self, element):
         for group in element_factory.getFactoryGroups():
             for name, factory in element_factory._groups[group].items():
@@ -77,10 +77,9 @@
 
     __used_for__ = IZCTextIndex
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('index')
 
         for value in self.context.getIndexSourceNames():
@@ -100,7 +99,7 @@
 
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
         indexed_attrs = []
@@ -110,3 +109,5 @@
                                   child.getAttribute('value').encode('utf-8'))
         self.context.indexed_attrs = indexed_attrs
         self.context.clear()
+
+    node = property(_exportNode, _importNode)

Modified: CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/configure.zcml
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/configure.zcml	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/configure.zcml	2005-12-15 16:58:31 UTC (rev 40790)
@@ -6,7 +6,7 @@
       factory=".exportimport.ZCatalogXMLAdapter"
       provides="Products.GenericSetup.interfaces.IBody"
       for="Products.ZCatalog.interfaces.IZCatalog
-           Products.GenericSetup.interfaces.ISetupContext"
+           Products.GenericSetup.interfaces.ISetupEnviron"
       />
 
 </configure>

Modified: CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/exportimport.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/exportimport.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/exportimport.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -15,9 +15,9 @@
 $Id$
 """
 
-from Products.GenericSetup.interfaces import INodeExporter
-from Products.GenericSetup.interfaces import INodeImporter
-from Products.GenericSetup.interfaces import PURGE
+from zope.app import zapi
+
+from Products.GenericSetup.interfaces import INode
 from Products.GenericSetup.utils import ObjectManagerHelpers
 from Products.GenericSetup.utils import PropertyManagerHelpers
 from Products.GenericSetup.utils import XMLAdapterBase
@@ -40,10 +40,9 @@
 
     _LOGGER_ID = 'catalog'
 
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
         node = self._getObjectNode('object')
         node.appendChild(self._extractProperties())
         node.appendChild(self._extractObjects())
@@ -53,19 +52,19 @@
         self._logger.info('Catalog exported.')
         return node
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
-        if mode == PURGE:
+        if self.environ.shouldPurge():
             self._purgeProperties()
             self._purgeObjects()
             self._purgeIndexes()
             self._purgeColumns()
 
-        self._initProperties(node, mode)
-        self._initObjects(node, mode)
-        self._initIndexes(node, mode)
-        self._initColumns(node, mode)
+        self._initProperties(node)
+        self._initObjects(node)
+        self._initIndexes(node)
+        self._initColumns(node)
 
         self._logger.info('Catalog imported.')
 
@@ -74,17 +73,16 @@
         indexes = self.context.getIndexObjects()[:]
         indexes.sort(lambda x,y: cmp(x.getId(), y.getId()))
         for idx in indexes:
-            exporter = INodeExporter(idx, None)
-            if exporter is None:
-                continue
-            fragment.appendChild(exporter.exportNode(self._doc))
+            exporter = zapi.queryMultiAdapter((idx, self.environ), INode)
+            if exporter:
+                fragment.appendChild(exporter.node)
         return fragment
 
     def _purgeIndexes(self):
         for idx_id in self.context.indexes():
             self.context.delIndex(idx_id)
 
-    def _initIndexes(self, node, mode):
+    def _initIndexes(self, node):
         for child in node.childNodes:
             if child.nodeName != 'index':
                 continue
@@ -106,7 +104,9 @@
                 zcatalog.addIndex(idx_id, meta_type, extra)
 
             idx = zcatalog._catalog.getIndex(idx_id)
-            INodeImporter(idx).importNode(child, mode)
+            importer = zapi.queryMultiAdapter((idx, self.environ), INode)
+            if importer:
+                importer.node = child
 
     def _extractColumns(self):
         fragment = self._doc.createDocumentFragment()
@@ -122,7 +122,7 @@
         for col in self.context.schema()[:]:
             self.context.delColumn(col)
 
-    def _initColumns(self, node, mode):
+    def _initColumns(self, node):
         for child in node.childNodes:
             if child.nodeName != 'column':
                 continue

Modified: CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/tests/test_exportimport.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/tests/test_exportimport.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/ZCatalog/tests/test_exportimport.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -25,7 +25,7 @@
 
 from Products.GenericSetup.interfaces import IBody
 from Products.GenericSetup.testing import BodyAdapterTestCase
-from Products.GenericSetup.tests.common import DummyExportContext
+from Products.GenericSetup.testing import DummySetupEnviron
 
 
 class _extra:
@@ -132,7 +132,9 @@
         obj.addIndex('foo_text', 'TextIndex')
 
     def setUp(self):
-        import Products.GenericSetup
+        import Products.GenericSetup.PluginIndexes
+        import Products.GenericSetup.ZCatalog
+        import Products.GenericSetup.ZCTextIndex
         from Products.ZCatalog.ZCatalog import ZCatalog
 
         BodyAdapterTestCase.setUp(self)
@@ -146,9 +148,9 @@
 
     def test_body_get_special(self):
         self._populate_special(self._obj)
-        context = DummyExportContext(None)
-        exporter = zapi.getMultiAdapter((self._obj, context), IBody)
-        self.assertEqual(exporter.body,
+        context = DummySetupEnviron()
+        adapted = zapi.getMultiAdapter((self._obj, context), IBody)
+        self.assertEqual(adapted.body,
                          _CATALOG_BODY % (_VOCABULARY_XML, _TEXT_XML))
 
 

Modified: CMF/branches/tseaver-viewification/GenericSetup/browser/utils.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/browser/utils.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/browser/utils.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -27,10 +27,12 @@
         if submit_add:
             obj = self.klass('temp')
             if settings_id:
-                profile_id, obj_id = settings_id.split('/')
+                ids = settings_id.split('/')
+                profile_id = ids[0]
+                obj_path = ids[1:]
                 if not add_input_name:
-                    self.request.set('add_input_name', obj_id)
-                self._initSettings(obj, profile_id, obj_id)
+                    self.request.set('add_input_name', obj_path[-1])
+                self._initSettings(obj, profile_id, obj_path)
             self.context.add(obj)
             self.request.response.redirect(self.context.nextURL())
             return ''

Modified: CMF/branches/tseaver-viewification/GenericSetup/context.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/context.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/context.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -104,6 +104,7 @@
         self._loggers = {}
         self._messages = []
         self._encoding = encoding
+        self._should_purge = True
 
     security.declareProtected( ManagePortal, 'getSite' )
     def getSite( self ):
@@ -146,7 +147,14 @@
         """
         self._messages[:] = []
 
+    security.declareProtected( ManagePortal, 'shouldPurge' )
+    def shouldPurge( self ):
 
+        """ See ISetupContext.
+        """
+        return self._should_purge
+
+
 class DirectoryImportContext( BaseContext ):
 
     implements(IImportContext)
@@ -224,13 +232,6 @@
 
         return [ name for name in names if name not in skip ]
 
-    security.declareProtected( ManagePortal, 'shouldPurge' )
-    def shouldPurge( self ):
-
-        """ See IImportContext.
-        """
-        return self._should_purge
-
 InitializeClass( DirectoryImportContext )
 
 

Modified: CMF/branches/tseaver-viewification/GenericSetup/interfaces.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/interfaces.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/interfaces.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -20,7 +20,6 @@
 from zope.schema import TextLine
 
 BASE, EXTENSION = range(1, 3)
-PURGE, UPDATE = range(1, 3)
 
 
 class IPseudoInterface( Interface ):
@@ -28,8 +27,23 @@
     """ API documentation;  not testable / enforceable.
     """
 
-class ISetupContext( Interface ):
 
+class ISetupEnviron(Interface):
+
+    """Context for im- and export adapters.
+    """
+
+    def getLogger(name):
+        """Get a logger with the specified name, creating it if necessary.
+        """
+
+    def shouldPurge():
+        """When installing, should the existing setup be purged?
+        """
+
+
+class ISetupContext(ISetupEnviron):
+
     """ Context used for export / import plugins.
     """
     def getSite():
@@ -49,10 +63,6 @@
         o Return None if the data should not be encoded.
         """
 
-    def getLogger(name):
-        """ Get a logger with the specified name, creating it if necessary.
-        """
-
     def listNotes():
         """ Return notes recorded by this context.
         
@@ -118,11 +128,7 @@
         o If 'path' does not point to a directory / folder, return None.
         """
 
-    def shouldPurge():
 
-        """ When installing, should the existing setup be purged?
-        """
-
 class IImportPlugin( IPseudoInterface ):
 
     """ Signature for callables used to import portions of site configuration.
@@ -588,38 +594,26 @@
         """
 
 
-class IBody(Interface):
+class INode(Interface):
 
-    """Body im- and exporter.
+    """Node im- and exporter.
     """
 
-    body = Text(description=u'Im- and export the object as a file body.')
+    node = Text(description=u'Im- and export the object as a DOM node.')
 
-    mime_type = TextLine(description=u'MIME type of the file body.')
 
-    suffix = TextLine(description=u'Suffix for the file.')
+class IBody(INode):
 
-
-class INodeExporter(Interface):
-
-    """Node exporter.
+    """Body im- and exporter.
     """
 
-    def exportNode(doc):
-        """Export the object as a DOM node.
-        """
+    body = Text(description=u'Im- and export the object as a file body.')
 
+    mime_type = TextLine(description=u'MIME type of the file body.')
 
-class INodeImporter(Interface):
+    suffix = TextLine(description=u'Suffix for the file.')
 
-    """Node importer.
-    """
 
-    def importNode(node, mode=PURGE):
-        """Import the object from the DOM node.
-        """
-
-
 class IFilesystemExporter(Interface):
     """ Plugin interface for site structure export.
     """

Modified: CMF/branches/tseaver-viewification/GenericSetup/testing.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/testing.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/testing.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -23,14 +23,12 @@
 import Products.Five
 from Products.Five import zcml
 from zope.app import zapi
+from zope.interface import implements
 from zope.interface.verify import verifyClass
 
 from interfaces import IBody
-from interfaces import INodeExporter
-from interfaces import INodeImporter
-from tests.common import DummyExportContext
-from tests.common import DummyImportContext
-from utils import PrettyDocument
+from interfaces import INode
+from interfaces import ISetupEnviron
 
 try:
     from zope.app.testing.placelesssetup import PlacelessSetup
@@ -38,8 +36,38 @@
     from zope.app.tests.placelesssetup import PlacelessSetup
 
 
-class BodyAdapterTestCase(PlacelessSetup, unittest.TestCase):
+class DummyLogger:
 
+    def __init__(self, id, messages):
+        self._id = id
+        self._messages = messages
+
+    def info(self, msg, *args, **kwargs):
+        self._messages.append((20, self._id, msg))
+
+    def warning(self, msg, *args, **kwargs):
+        self._messages.append((30, self._id, msg))
+
+
+class DummySetupEnviron(object):
+
+    """Context for body im- and exporter.
+    """
+
+    implements(ISetupEnviron)
+
+    def __init__(self):
+        self._notes = []
+
+    def getLogger(self, name):
+        return DummyLogger(name, self._notes)
+
+    def shouldPurge(self):
+        return True
+
+
+class _AdapterTestCaseBase(PlacelessSetup, unittest.TestCase):
+
     def _populate(self, obj):
         pass
 
@@ -51,56 +79,40 @@
         zcml.load_config('meta.zcml', Products.Five)
         zcml.load_config('permissions.zcml', Products.Five)
 
-    def tearDown(self):
-        PlacelessSetup.tearDown(self)
 
+class BodyAdapterTestCase(_AdapterTestCaseBase):
+
     def test_z3interfaces(self):
         verifyClass(IBody, self._getTargetClass())
 
     def test_body_get(self):
         self._populate(self._obj)
-        context = DummyExportContext(None)
-        exporter = zapi.getMultiAdapter((self._obj, context), IBody)
-        self.assertEqual(exporter.body, self._BODY)
+        context = DummySetupEnviron()
+        adapted = zapi.getMultiAdapter((self._obj, context), IBody)
+        self.assertEqual(adapted.body, self._BODY)
 
     def test_body_set(self):
-        context = DummyImportContext(None)
-        importer = zapi.getMultiAdapter((self._obj, context), IBody)
-        importer.body = self._BODY
+        context = DummySetupEnviron()
+        adapted = zapi.getMultiAdapter((self._obj, context), IBody)
+        adapted.body = self._BODY
         self._verifyImport(self._obj)
-        context = DummyExportContext(None)
-        exporter = zapi.getMultiAdapter((self._obj, context), IBody)
-        self.assertEqual(exporter.body, self._BODY)
+        self.assertEqual(adapted.body, self._BODY)
 
 
-class NodeAdapterTestCase(PlacelessSetup, unittest.TestCase):
+class NodeAdapterTestCase(_AdapterTestCaseBase):
 
-    def _populate(self, obj):
-        pass
-
-    def _verifyImport(self, obj):
-        pass
-
-    def setUp(self):
-        PlacelessSetup.setUp(self)
-        zcml.load_config('meta.zcml', Products.Five)
-        zcml.load_config('permissions.zcml', Products.Five)
-
-    def tearDown(self):
-        PlacelessSetup.tearDown(self)
-
     def test_z3interfaces(self):
-        verifyClass(INodeExporter, self._getTargetClass())
-        verifyClass(INodeImporter, self._getTargetClass())
+        verifyClass(INode, self._getTargetClass())
 
-    def test_exportNode(self):
+    def test_node_get(self):
         self._populate(self._obj)
-        node = INodeExporter(self._obj).exportNode(PrettyDocument())
-        self.assertEqual(node.toprettyxml(' '), self._XML)
+        context = DummySetupEnviron()
+        adapted = zapi.getMultiAdapter((self._obj, context), INode)
+        self.assertEqual(adapted.node.toprettyxml(' '), self._XML)
 
-    def test_importNode(self):
-        node = parseString(self._XML).documentElement
-        self.assertEqual(INodeImporter(self._obj).importNode(node), None)
+    def test_node_set(self):
+        context = DummySetupEnviron()
+        adapted = zapi.getMultiAdapter((self._obj, context), INode)
+        adapted.node = parseString(self._XML).documentElement
         self._verifyImport(self._obj)
-        node = INodeExporter(self._obj).exportNode(PrettyDocument())
-        self.assertEqual(node.toprettyxml(' '), self._XML)
+        self.assertEqual(adapted.node.toprettyxml(' '), self._XML)

Modified: CMF/branches/tseaver-viewification/GenericSetup/tests/common.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/tests/common.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/tests/common.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -25,6 +25,7 @@
 
 from Products.GenericSetup.interfaces import IExportContext
 from Products.GenericSetup.interfaces import IImportContext
+from Products.GenericSetup.testing import DummyLogger
 
 
 class OmnipotentUser(Implicit):
@@ -179,19 +180,6 @@
         self._compareDOM( found, data )
 
 
-class DummyLogger:
-
-    def __init__(self, id, messages):
-        self._id = id
-        self._messages = messages
-
-    def info(self, msg, *args, **kwargs):
-        self._messages.append((20, self._id, msg))
-
-    def warning(self, msg, *args, **kwargs):
-        self._messages.append((30, self._id, msg))
-
-
 class DummyExportContext:
 
     implements(IExportContext)

Modified: CMF/branches/tseaver-viewification/GenericSetup/tests/test_utils.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/tests/test_utils.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/tests/test_utils.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -20,8 +20,8 @@
 
 from xml.dom.minidom import parseString
 
-from Products.GenericSetup.interfaces import PURGE, UPDATE
 from Products.GenericSetup.utils import PrettyDocument
+from Products.GenericSetup.testing import DummySetupEnviron
 
 
 _EMPTY_PROPERTY_EXPORT = """\
@@ -210,7 +210,7 @@
         obj._setProperty('foo_selection', 'foobarbaz', 'selection')
         obj._setProperty('foo_mselection', 'foobarbaz', 'multiple selection')
         obj._setProperty('foo_boolean0', '', 'boolean')
-        self.helpers = self._makeOne(obj)
+        self.helpers = self._makeOne(obj, DummySetupEnviron())
 
     def _populate(self, obj):
         obj._updateProperty('foo_boolean', 'True')
@@ -245,7 +245,7 @@
 
     def test__initProperties_normal(self):
         node = parseString(_NORMAL_PROPERTY_EXPORT).documentElement
-        self.helpers._initProperties(node, PURGE)
+        self.helpers._initProperties(node)
         self.assertEqual(type(self.helpers.context.foo_int), int)
         self.assertEqual(type(self.helpers.context.foo_string), str)
         self.assertEqual(type(self.helpers.context.foo_tokens), tuple)
@@ -260,7 +260,7 @@
 
     def test__initProperties_fixed(self):
         node = parseString(_FIXED_PROPERTY_EXPORT).documentElement
-        self.helpers._initProperties(node, PURGE)
+        self.helpers._initProperties(node)
 
         doc = self.helpers._doc = PrettyDocument()
         node = doc.createElement('dummy')
@@ -271,7 +271,7 @@
 
     def test__initProperties_special(self):
         node = parseString(_SPECIAL_IMPORT).documentElement
-        self.helpers._initProperties(node, UPDATE)
+        self.helpers._initProperties(node)
 
         doc = self.helpers._doc = PrettyDocument()
         node = doc.createElement('dummy')

Modified: CMF/branches/tseaver-viewification/GenericSetup/utils.py
===================================================================
--- CMF/branches/tseaver-viewification/GenericSetup/utils.py	2005-12-15 13:38:11 UTC (rev 40789)
+++ CMF/branches/tseaver-viewification/GenericSetup/utils.py	2005-12-15 16:58:31 UTC (rev 40790)
@@ -16,6 +16,7 @@
 """
 
 import os
+import sys
 from inspect import getdoc
 from xml.dom.minidom import _nssplit
 from xml.dom.minidom import Document
@@ -41,10 +42,8 @@
 
 from exceptions import BadRequest
 from interfaces import IBody
-from interfaces import INodeExporter
-from interfaces import INodeImporter
+from interfaces import INode
 from interfaces import ISetupContext
-from interfaces import PURGE, UPDATE
 from permissions import ManagePortal
 
 
@@ -68,6 +67,8 @@
 
 def _resolveDottedName( dotted ):
 
+    __traceback_info__ = dotted
+
     parts = dotted.split( '.' )
 
     if not parts:
@@ -81,6 +82,8 @@
             break
 
         except ImportError:
+            # Reraise if the import error was caused inside the imported file
+            if sys.exc_info()[2].tb_next is not None: raise
 
             del parts_copy[ -1 ]
 
@@ -297,9 +300,10 @@
 
 class _LineWrapper:
 
-    def __init__(self, writer, indent, newl, max):
+    def __init__(self, writer, indent, addindent, newl, max):
         self._writer = writer
         self._indent = indent
+        self._addindent = addindent
         self._newl = newl
         self._max = max
         self._length = 0
@@ -314,7 +318,8 @@
         if 0 < self._length > self._max - len(self._queue):
             self._writer.write(self._newl)
             self._length = 0
-            self._queue = '%s  %s' % (self._indent, self._queue)
+            self._queue = '%s%s %s' % (self._indent, self._addindent,
+                                       self._queue)
 
         if self._queue != self._indent:
             self._writer.write(self._queue)
@@ -336,7 +341,7 @@
         # indent = current indentation
         # addindent = indentation to add to higher levels
         # newl = newline string
-        wrapper = _LineWrapper(writer, indent, newl, 78)
+        wrapper = _LineWrapper(writer, indent, addindent, newl, 78)
         wrapper.write('<%s' % self.tagName)
 
         # move 'name', 'meta_type' and 'title' to the top, sort the rest 
@@ -368,7 +373,7 @@
                     if textlines:
                         for textline in textlines:
                             wrapper.write('', True)
-                            wrapper.queue(' %s' % textline)
+                            wrapper.queue('%s%s' % (addindent, textline))
                 else:
                     wrapper.write('', True)
                     node.writexml(writer, indent+addindent, addindent, newl)
@@ -403,12 +408,12 @@
             node.writexml(writer, indent, addindent, newl)
 
 
-class BodyAdapterBase(object):
+class NodeAdapterBase(object):
 
-    """Body im- and exporter base.
+    """Node im- and exporter base.
     """
 
-    implements(IBody)
+    implements(INode)
 
     _LOGGER_ID = ''
 
@@ -416,49 +421,25 @@
         self.context = context
         self.environ = environ
         self._logger = environ.getLogger(self._LOGGER_ID)
+        self._doc = PrettyDocument()
 
-    def _exportBody(self):
-        """Export the object as a file body.
-        """
-        return ''
-
-    def _importBody(self, body):
-        """Import the object from the file body.
-        """
-
-    body = property(_exportBody, _importBody)
-
-    mime_type = 'text/plain'
-
-    suffix = ''
-
-
-class NodeAdapterBase(object):
-
-    """Node im- and exporter base.
-    """
-
-    implements(INodeExporter, INodeImporter)
-
-    def __init__(self, context):
-        self.context = context
-
-    def exportNode(self, doc):
+    def _exportNode(self):
         """Export the object as a DOM node.
         """
-        self._doc = doc
-        return self._getObjectNode('object')
+        return self._getObjectNode('object', False)
 
-    def importNode(self, node, mode=PURGE):
+    def _importNode(self, node):
         """Import the object from the DOM node.
         """
 
-    def _getObjectNode(self, name):
+    node = property(_exportNode, _importNode)
+
+    def _getObjectNode(self, name, i18n=True):
         node = self._doc.createElement(name)
         node.setAttribute('name', self.context.getId())
         node.setAttribute('meta_type', self.context.meta_type)
         i18n_domain = getattr(self.context, 'i18n_domain', None)
-        if i18n_domain:
+        if i18n and i18n_domain:
             node.setAttributeNS(I18NURI, 'i18n:domain', i18n_domain)
             self._i18n_props = ('title', 'description')
         return node
@@ -476,23 +457,46 @@
         return val.lower() in ('true', 'yes', '1')
 
 
-class XMLAdapterBase(BodyAdapterBase, NodeAdapterBase):
+class BodyAdapterBase(NodeAdapterBase):
 
+    """Body im- and exporter base.
+    """
+
+    implements(IBody)
+
+    def _exportBody(self):
+        """Export the object as a file body.
+        """
+        return ''
+
+    def _importBody(self, body):
+        """Import the object from the file body.
+        """
+
+    body = property(_exportBody, _importBody)
+
+    mime_type = 'text/plain'
+
+    suffix = ''
+
+
+class XMLAdapterBase(NodeAdapterBase):
+
     """XML im- and exporter base.
     """
 
+    implements(IBody)
+
     def _exportBody(self):
         """Export the object as a file body.
         """
-        doc = PrettyDocument()
-        doc.appendChild(self.exportNode(doc))
-        return doc.toprettyxml(' ')
+        self._doc.appendChild(self._exportNode())
+        return self._doc.toprettyxml(' ')
 
     def _importBody(self, body):
         """Import the object from the file body.
         """
-        mode = self.environ.shouldPurge() and PURGE or UPDATE
-        self.importNode(parseString(body).documentElement, mode=mode)
+        self._importNode(parseString(body).documentElement)
 
     body = property(_exportBody, _importBody)
 
@@ -512,24 +516,16 @@
         if not IOrderedContainer.providedBy(self.context):
             objects.sort(lambda x,y: cmp(x.getId(), y.getId()))
         for obj in objects:
-            exporter = INodeExporter(obj, None)
+            exporter = zapi.queryMultiAdapter((obj, self.environ), INode)
             if exporter:
-                node = exporter.exportNode(self._doc)
-                fragment.appendChild(node)
-            else:
-                adapters = zapi.getService(zapi.servicenames.Adapters)
-                if adapters.lookup((providedBy(obj), ISetupContext), IBody):
-                    node = self._doc.createElement('object')
-                    node.setAttribute('name', obj.getId())
-                    node.setAttribute('meta_type', obj.meta_type)
-                    fragment.appendChild(node)
+                fragment.appendChild(exporter.node)
         return fragment
 
     def _purgeObjects(self):
         for obj_id in self.context.objectIds():
             self.context._delObject(obj_id)
 
-    def _initObjects(self, node, mode):
+    def _initObjects(self, node):
         for child in node.childNodes:
             if child.nodeName != 'object':
                 continue
@@ -545,7 +541,7 @@
                         parent._setObject(obj_id, mt_info['instance'](obj_id))
                         break
                 else:
-                    raise ValueError('unknown meta_type \'%s\'' % meta_type)
+                    raise ValueError("unknown meta_type '%s'" % meta_type)
 
             if child.hasAttribute('insert-before'):
                 insert_before = child.getAttribute('insert-before')
@@ -569,9 +565,9 @@
                         pass
 
             obj = getattr(self.context, obj_id)
-            importer = INodeImporter(obj, None)
+            importer = zapi.queryMultiAdapter((obj, self.environ), INode)
             if importer:
-                importer.importNode(child, mode)
+                importer.node = child
 
 
 class PropertyManagerHelpers(object):
@@ -630,7 +626,7 @@
                     prop_value = ''
                 self.context._updateProperty(prop_id, prop_value)
 
-    def _initProperties(self, node, mode):
+    def _initProperties(self, node):
         self.context.i18n_domain = node.getAttribute('i18n:domain')
         for child in node.childNodes:
             if child.nodeName != 'property':
@@ -645,7 +641,7 @@
                     obj._setProperty(prop_id, val, child.getAttribute('type'))
                     prop_map = obj.propdict().get(prop_id, None)
                 else:
-                    raise ValueError('undefined property \'%s\'' % prop_id)
+                    raise ValueError("undefined property '%s'" % prop_id)
 
             if not 'w' in prop_map.get('mode', 'wd'):
                 raise BadRequest('%s cannot be changed' % prop_id)



More information about the CMF-checkins mailing list