[Zope3-checkins] CVS: Zope3/src/zope/app/container/browser - adding.py:1.4

Suresh Babu Eddala sbabu at zeomega.com
Thu May 6 11:46:35 EDT 2004


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

Modified Files:
	adding.py 
Log Message:
The renderAddButton method is deprecated, use nameAllowed method.


=== Zope3/src/zope/app/container/browser/adding.py 1.3 => 1.4 ===
--- Zope3/src/zope/app/container/browser/adding.py:1.3	Tue Apr 27 11:45:10 2004
+++ Zope3/src/zope/app/container/browser/adding.py	Thu May  6 11:46:04 2004
@@ -20,6 +20,7 @@
 """
 __metaclass__ = type
 
+from warnings import warn
 import zope.security.checker
 from zope.interface import implements
 from zope.publisher.interfaces import IPublishTraverse
@@ -88,25 +89,9 @@
 
 
     def renderAddButton(self):
-        """To Render Add button with or without Inputbox"""
-        container = self.context
-        add_button_value = _('add-button', 'Add')
-        add_button_label = _('add-button-label','Object Name')
-        
-        add_button_value = translate(self.context, add_button_value,
-                                     context=self.request)
-        add_button_label = translate(self.context, add_button_label,
-                                     context=self.request)
-        if IContainerNamesContainer.providedBy(container):
-            return " <input type='submit' name='UPDATE_SUBMIT' value='%s'>" \
-                   % add_button_value
-        else:
-            contentName = self.contentName or ''
-            return (
-               "&nbsp;&nbsp;<input type='submit' name='UPDATE_SUBMIT' value='%s'>"
-               "&nbsp;&nbsp;<b>%s:</b>&nbsp;"
-               "<input type='text' name='add_input_name' value='%s'>"
-                    % (add_button_value, add_button_label, contentName))
+        warn("The renderAddButton method is deprecated, use nameAllowed",
+            DeprecationWarning, 2)
+    
 
     def publishTraverse(self, request, name):
         """See zope.app.container.interfaces.IAdding"""
@@ -178,6 +163,11 @@
 
     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):
 




More information about the Zope3-Checkins mailing list