Log message for revision 101273:
  - resynced Products.Five.browser.adding with zope.app.container.browser.adding

Changed:
  U   Zope/trunk/src/Products/Five/browser/adding.py

-=-
Modified: Zope/trunk/src/Products/Five/browser/adding.py
===================================================================
--- Zope/trunk/src/Products/Five/browser/adding.py      2009-06-25 14:11:20 UTC 
(rev 101272)
+++ Zope/trunk/src/Products/Five/browser/adding.py      2009-06-25 14:12:36 UTC 
(rev 101273)
@@ -23,35 +23,33 @@
 
 __docformat__ = 'restructuredtext'
 
-from warnings import warn
-
+from zope.app.publisher.browser.menu import getMenu
+from zope.browser.interfaces import IAdding
 from zope.component import getMultiAdapter
 from zope.component import getUtility
 from zope.component import queryMultiAdapter
 from zope.component import queryUtility
 from zope.component.interfaces import IFactory
-from zope.container.constraints import checkFactory, checkObject
+from zope.container.constraints import checkFactory
+from zope.container.constraints import checkObject
 from zope.container.i18n import ZopeMessageFactory as _
 from zope.container.interfaces import IContainerNamesContainer
 from zope.container.interfaces import INameChooser
-
 from zope.event import notify
+from zope.exceptions.interfaces import UserError
 from zope.interface import implements
+from zope.lifecycleevent import ObjectCreatedEvent
 from zope.publisher.interfaces import IPublishTraverse
 from zope.traversing.browser.absoluteurl import absoluteURL
-from zope.exceptions.interfaces import UserError
-from zope.lifecycleevent import ObjectCreatedEvent
 
-from zope.browser.interfaces import IAdding
-from zope.app.publisher.browser.menu import getMenu
-
 from zExceptions import BadRequest
 from OFS.SimpleItem import SimpleItem
 
 from Products.Five import BrowserView
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 
-class BasicAdding(BrowserView):
+
+class Adding(BrowserView):
     implements(IAdding, IPublishTraverse)
 
     def add(self, content):
@@ -80,8 +78,8 @@
                 # Invoke the name chooser even when we have a
                 # name. It'll do useful things with it like converting
                 # the incoming unicode to an ASCII string.
-                name = chooser.chooseName(name, container)
-        
+                name = chooser.chooseName(name, content)
+
         content.id = name
         container._setObject(name, content)
         self.contentName = name # Set the added object Name
@@ -94,18 +92,12 @@
         # XXX this is definitely not right for all or even most uses
         # of Five, but can be overridden by an AddView subclass, using
         # the class attribute of a zcml:addform directive
-        return str(getMultiAdapter((self.context, self.request),
-                                   name=u"absolute_url")) + '/manage_main'
+        return absoluteURL(self.context, self.request) + '/manage_main'
 
     # set in BrowserView.__init__
     request = None
     context = None
 
-    def renderAddButton(self):
-        warn("The renderAddButton method is deprecated, use nameAllowed",
-            DeprecationWarning, 2)
-    
-
     def publishTraverse(self, request, name):
         """See zope.publisher.interfaces.IPublishTraverse"""
         if '=' in name:
@@ -127,7 +119,7 @@
 
         factory = queryUtility(IFactory, name)
         if factory is None:
-            return super(BasicAdding, self).publishTraverse(request, name)
+            return super(Adding, self).publishTraverse(request, name)
 
         return factory
 
@@ -143,11 +135,10 @@
         else:
             view_name = type_name
 
-        if (queryMultiAdapter((self, self.request), name=view_name)
-            is not None):
+        if queryMultiAdapter((self, self.request),
+                                  name=view_name) is not None:
             url = "%s/%s=%s" % (
-                getMultiAdapter((self, self.request), name=u"absolute_url"),
-                type_name, id)
+                absoluteURL(self, self.request), type_name, id)
             self.request.response.redirect(url)
             return
 
@@ -162,16 +153,10 @@
         self.add(content)
         self.request.response.redirect(self.nextURL())
 
-    def namesAccepted(self):
-        return not IContainerNamesContainer.providedBy(self.context)
-
     def nameAllowed(self):
         """Return whether names can be input by the user."""
         return not IContainerNamesContainer.providedBy(self.context)
 
-
-class Adding(BasicAdding):
-
     menu_id = None
     index = ViewPageTemplateFile("adding.pt")
 

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to