[Zope3-checkins] CVS: Zope3/src/zope/app/browser/container - add.pt:1.16 adding.py:1.30

Philipp von Weitershausen philikon at philikon.de
Mon Dec 15 06:02:09 EST 2003


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

Modified Files:
	add.pt adding.py 
Log Message:
Fix i18n in add forms. Using i18n:attributes at the same with tal:replace
is pretty useless. It was simply a matter of generating a message id in
python.

Also, fixed container's add form. It was using view's variables which
don't seem to exist anymore. If anyone remembers where they went (couldn't
find them in the CVS diff), feel free to insert them again.


=== Zope3/src/zope/app/browser/container/add.pt 1.15 => 1.16 ===
--- Zope3/src/zope/app/browser/container/add.pt:1.15	Tue Dec  9 05:45:48 2003
+++ Zope3/src/zope/app/browser/container/add.pt	Mon Dec 15 06:01:39 2003
@@ -2,11 +2,11 @@
 <body>
 <div metal:fill-slot="body">
 
-  <form action="action.html" method="post"
-    tal:attributes="action view/actionName">
+  <form action="action.html" method="post" action="action.html">
     <table class="TypeListing" cellpadding="3">
 
-      <caption tal:content="view/title">Add Content</caption>
+      <caption>Add Content</caption>
+      <!--caption tal:content="view/title">Add Content</caption-->
 
       <tbody tal:define="infos view/addingInfo">
 
@@ -37,8 +37,8 @@
             <input type="text" name="id"
                    tal:condition="view/namesAccepted"
                    tal:attributes="value request/id | nothing" />
-            <input type="submit" name="add" value=" Add " 
-                   tal:attributes="value view/addValue" />
+            <input type="submit" name="add" value=" Add "
+                   i18n:attributes="value add-button" />
         </td>
       </tr>
 


=== Zope3/src/zope/app/browser/container/adding.py 1.29 => 1.30 ===
--- Zope3/src/zope/app/browser/container/adding.py:1.29	Sun Dec 14 04:38:17 2003
+++ Zope3/src/zope/app/browser/container/adding.py	Mon Dec 15 06:01:39 2003
@@ -20,49 +20,41 @@
 """
 __metaclass__ = type
 
-from zope.app import zapi
+import zope.security.checker
+from zope.interface import implements
+from zope.publisher.interfaces import IPublishTraverse
+from zope.proxy import removeAllProxies
 
 from zope.app.interfaces.exceptions import UserError
-
 from zope.app.interfaces.container import IAdding
 from zope.app.interfaces.container import IContainerNamesContainer
 from zope.app.interfaces.container import INameChooser
 
+from zope.app import zapi
 from zope.app.event.objectevent import ObjectCreatedEvent
 from zope.app.pagetemplate.viewpagetemplatefile import ViewPageTemplateFile
 from zope.app.event import publish
 from zope.app.publisher.browser import BrowserView
-from zope.publisher.interfaces import IPublishTraverse
 
 from zope.app.i18n import ZopeMessageIDFactory as _
-from zope.interface import implements
-
 from zope.app.location import LocationProxy
-import zope.security.checker
-
-from zope.proxy import removeAllProxies
-
 from zope.app.container.constraints import checkFactory
 
 
 class BasicAdding(BrowserView):
-
     implements(IAdding, IPublishTraverse)
 
     def add(self, content):
-        """See zope.app.interfaces.container.IAdding"""
-
+        """See zope.app.interfaces.container.IAdding
+        """
         container = self.context
         name = self.contentName
-
-
         chooser = zapi.getAdapter(container, INameChooser)
         
         if IContainerNamesContainer.isImplementedBy(container):
             # The container pick's it's own names.
             # We need to ask it to pick one.
             name = chooser.chooseName(self.contentName or '', content)
-            
         else:
             request = self.request           
             name = request.get('add_input_name',name)
@@ -92,13 +84,15 @@
     def renderAddButton(self):
         """To Render Add button with or without Inputbox"""
         container = self.context
+        button_label = _('add-button', 'Add')
         if IContainerNamesContainer.isImplementedBy(container):
-            return "<input type='submit' name='UPDATE_SUBMIT' value=' Add '>"
+            return "<input type='submit' name='UPDATE_SUBMIT' value=' %s '>" \
+                   % button_label
         else:
             contentName = self.contentName or ''
-            return ("<input type='submit' name='UPDATE_SUBMIT' value=' Add '>"
-                    "<input type='text' name='add_input_name' value='%s'>"
-                    % contentName)
+            return ("<input type='submit' name='UPDATE_SUBMIT' value=' %s '>"
+                    "<input type='text' name='add_input_name' value=' %s '>"
+                    % (button_label, contentName))
 
     def publishTraverse(self, request, name):
         """See zope.app.interfaces.container.IAdding"""




More information about the Zope3-Checkins mailing list