[Checkins] SVN: Zope3/trunk/ Fixed issue 572, http://www.zope.org/Collectors/Zope3-dev/572.

Jim Fulton jim at zope.com
Sun Jul 16 10:30:12 EDT 2006


Log message for revision 69143:
  Fixed issue 572, http://www.zope.org/Collectors/Zope3-dev/572.
  
  The icon directive title attribute wasn't implemented.
  

Changed:
  U   Zope3/trunk/doc/CHANGES.txt
  U   Zope3/trunk/src/zope/app/publisher/browser/icon.py
  U   Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py

-=-
Modified: Zope3/trunk/doc/CHANGES.txt
===================================================================
--- Zope3/trunk/doc/CHANGES.txt	2006-07-16 14:14:34 UTC (rev 69142)
+++ Zope3/trunk/doc/CHANGES.txt	2006-07-16 14:30:11 UTC (rev 69143)
@@ -16,6 +16,8 @@
 
     Bug fixes
 
+      - Fixed issue 572: The icon directive title attribute wasn't implemented.
+
       - TAL interpreter didn't translate i18n Messages when inserted
         as structure;
 

Modified: Zope3/trunk/src/zope/app/publisher/browser/icon.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/icon.py	2006-07-16 14:14:34 UTC (rev 69142)
+++ Zope3/trunk/src/zope/app/publisher/browser/icon.py	2006-07-16 14:30:11 UTC (rev 69143)
@@ -61,14 +61,14 @@
         return IconView(context, request, self.rname, self.alt)
 
 def IconDirective(_context, name, for_, file=None, resource=None,
-                  layer=IDefaultBrowserLayer, alt=None):
+                  layer=IDefaultBrowserLayer, title=None):
 
     iname = for_.getName()
 
-    if alt is None:
-        alt = iname
-        if IName.match(alt):
-            alt = alt[1:] # Remove leading 'I'
+    if title is None:
+        title = iname
+        if IName.match(title):
+            title = title[1:] # Remove leading 'I'
 
     if file is not None and resource is not None:
         raise ConfigurationError(
@@ -89,7 +89,7 @@
             "attributes for resource directives must be specified"
             )
 
-    vfactory = IconViewFactory(resource, alt)
+    vfactory = IconViewFactory(resource, title)
 
     _context.action(
         discriminator = ('view', name, vfactory, layer),

Modified: Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py
===================================================================
--- Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py	2006-07-16 14:14:34 UTC (rev 69142)
+++ Zope3/trunk/src/zope/app/publisher/browser/tests/test_icondirective.py	2006-07-16 14:30:11 UTC (rev 69143)
@@ -68,13 +68,15 @@
         defineCheckers()
         
     def test(self):
-        self.assertEqual(zapi.queryMultiAdapter((ob, request), name='zmi_icon'),
-                         None)
+        self.assertEqual(
+            zapi.queryMultiAdapter((ob, request), name='zmi_icon'),
+            None)
 
         import zope.app.publisher.browser.tests as p
         path = os.path.dirname(p.__file__)
         path = os.path.join(path, 'testfiles', 'test.gif')
 
+        # Configure the icon and make sure we can render the resulting view:
         xmlconfig(StringIO(template % (
             '''
             <browser:icon name="zmi_icon"
@@ -91,6 +93,25 @@
             'width="16" height="16" border="0" />'
             % rname)
 
+        # Make sure that the title attribute works
+        xmlconfig(StringIO(template % (
+            '''
+            <browser:icon name="zmi_icon_w_title"
+                      for="zope.app.component.tests.views.IC"
+                      file="%s" title="click this!" />
+            ''' % path
+            )))
+
+        view = zapi.getMultiAdapter((ob, request), name='zmi_icon_w_title')
+        rname = 'zope-app-component-tests-views-IC-zmi_icon_w_title.gif'
+        self.assertEqual(
+            view(),
+            '<img src="http://127.0.0.1/@@/%s" alt="click this!" '
+            'width="16" height="16" border="0" />'
+            % rname)
+
+
+        # Make sure that the image was installed as a resource:
         resource = ProxyFactory(zapi.getAdapter(request, name=rname))
         self.assertRaises(Forbidden, getattr, resource, '_testData')
         resource = removeSecurityProxy(resource)



More information about the Checkins mailing list