[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - adding.py:1.19.2.1 contents.py:1.25.8.1 find.py:1.6.2.1

Jim Fulton jim at zope.com
Mon Sep 8 15:22:24 EDT 2003


Update of /cvs-repository/Zope3/src/zope/app/browser/container
In directory cvs.zope.org:/tmp/cvs-serv20092/src/zope/app/browser/container

Modified Files:
      Tag: parentgeddon-branch
	adding.py contents.py find.py 
Log Message:
Checking in work in progress on parentgeddon-branch so Fred can help
me to get the tests passing.  Specific log entries will be provided
when we merge this into the head.


=== Zope3/src/zope/app/browser/container/adding.py 1.19 => 1.19.2.1 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.19	Wed Sep  3 14:33:55 2003
+++ Zope3/src/zope/app/browser/container/adding.py	Mon Sep  8 14:21:23 2003
@@ -26,12 +26,12 @@
 
 from zope.app.interfaces.container import IAdding
 from zope.app.interfaces.container import IContainerNamesContainer
-from zope.app.interfaces.container import IZopeContainer
+from zope.app.interfaces.container import IAddTarget
 
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.event import publish
-from zope.publisher.browser import BrowserView
+from zope.app.publisher.browser import BrowserView
 from zope.publisher.interfaces import IPublishTraverse
 
 from zope.app.i18n import ZopeMessageIDFactory as _
@@ -45,8 +45,8 @@
 
     def add(self, content):
         """See zope.app.interfaces.container.IAdding"""
-        container = zapi.getAdapter(self.context, IZopeContainer)
-        name = container.setObject(self.contentName, content)
+        container = zapi.getAdapter(self.context, IAddTarget)
+        name = container.addObject(self.contentName, content)
         return container[name]
 
     contentName = None # usually set by Adding traverser
@@ -81,14 +81,10 @@
 
         factory = zapi.queryFactory(self.context, name)
         if factory is None:
-            return zapi.ContextSuper(BasicAdding, self).publishTraverse(
-                request, name)
+            return super(BasicAdding, self).publishTraverse(request, name)
 
         return factory
 
-    # See zope.app.interfaces.container.IAdding
-    publishTraverse = zapi.ContextMethod(publishTraverse)
-
     def action(self, type_name='', id=''):
         if not type_name:
             raise UserError(_(u"You must select the type of object to add."))
@@ -119,9 +115,6 @@
         self.add(content)
         self.request.response.redirect(self.nextURL())
 
-    action = zapi.ContextMethod(action)
-
-
     def namesAccepted(self):
         return not IContainerNamesContainer.isImplementedBy(self.context)
 
@@ -142,4 +135,3 @@
                                       wrapped_self.request)
         result.sort(lambda a, b: cmp(a['title'], b['title']))
         return result
-    addingInfo = zapi.ContextMethod(addingInfo)


=== Zope3/src/zope/app/browser/container/contents.py 1.25 => 1.25.8.1 ===
--- Zope3/src/zope/app/browser/container/contents.py:1.25	Wed Aug  6 10:41:36 2003
+++ Zope3/src/zope/app/browser/container/contents.py	Mon Sep  8 14:21:23 2003
@@ -17,11 +17,11 @@
 """
 
 from zope.app import zapi
-from zope.app.interfaces.container import IContainer, IZopeContainer
+from zope.app.interfaces.container import IContainer, IRemoveSource
 from zope.app.interfaces.dublincore import IZopeDublinCore
 from zope.app.interfaces.size import ISized
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
-from zope.publisher.browser import BrowserView
+from zope.app.publisher.browser import BrowserView
 from zope.app.interfaces.copypastemove import IPrincipalClipboard
 from zope.app.interfaces.copypastemove import IObjectCopier
 from zope.app.interfaces.copypastemove import IObjectMover
@@ -29,9 +29,8 @@
 from zope.app.interfaces.container import ICopySource, IMoveSource
 from zope.app.interfaces.dublincore import IDCDescriptiveProperties
 from zope.app.i18n import ZopeMessageIDFactory as _
-
 from zope.app.browser.container.adding import BasicAdding
-
+from zope.app.copypastemove import rename
 
 class Contents(BrowserView):
 
@@ -97,8 +96,7 @@
                  )
         self.normalButtons = not self.specialButtons
 
-        info = map(self._extractContentInfo,
-                   zapi.getAdapter(self.context, IZopeContainer).items())
+        info = map(self._extractContentInfo, self.context.items())
 
         self.supportsCut = (
             info and zapi.queryAdapter(self.context, IMoveSource) is not None)
@@ -176,10 +174,9 @@
         ids = request.get("rename_ids")
         newids = request.get("new_value")
 
-        for id, newid in map(None, ids, newids):
-            if newid != id:
-                container = zapi.getAdapter(self.context, IZopeContainer)
-                container.rename(id, newid)
+        for oldid, newid in map(None, ids, newids):
+            if newid != oldid:
+                rename(self.context, oldid, newid)
 
     def changeTitle(self):
         """Given a sequence of tuples of old, new ids we rename"""
@@ -203,13 +200,11 @@
                 # if the type name names a view.
                 # Note that we can't so this for the "adding is None" case
                 # above, because there is no "+" view.
-                adding = zapi.ContextWrapper(adding, self.context, name="+")
+                adding.__parent__ = self.context
+                adding.__name__ = '+'
 
             adding.action(request['type_name'], new)
 
-
-
-
     def removeObjects(self):
         """Remove objects specified in a list of object ids"""
         request = self.request
@@ -218,9 +213,9 @@
             self.error = _("You didn't specify any ids to remove.")
             return
 
-        container = zapi.getAdapter(self.context, IZopeContainer)
+        container = zapi.getAdapter(self.context, IRemoveSource)
         for id in ids:
-            container.__delitem__(id)
+            container.removeObject(id)
 
     def copyObjects(self):
         """Copy objects specified in a list of object ids"""


=== Zope3/src/zope/app/browser/container/find.py 1.6 => 1.6.2.1 ===
--- Zope3/src/zope/app/browser/container/find.py:1.6	Fri Sep  5 14:43:20 2003
+++ Zope3/src/zope/app/browser/container/find.py	Mon Sep  8 14:21:23 2003
@@ -20,7 +20,7 @@
 from zope.app.interfaces.find import IFind
 from zope.app.traversing import getName
 from zope.component import getAdapter, getView
-from zope.publisher.browser import BrowserView
+from zope.app.publisher.browser import BrowserView
 
 # XXX very simple implementation right now
 class Find(BrowserView):




More information about the Zope3-Checkins mailing list