[Zope3-checkins] SVN: Zope3/branches/3.3/ Fixed issue 572,
http://www.zope.org/Collectors/Zope3-dev/572.
Jim Fulton
jim at zope.com
Sun Jul 16 10:14:36 EDT 2006
Log message for revision 69142:
Fixed issue 572, http://www.zope.org/Collectors/Zope3-dev/572.
The icon directive title attribute wasn't implemented.
Changed:
U Zope3/branches/3.3/doc/CHANGES.txt
U Zope3/branches/3.3/src/zope/app/publisher/browser/icon.py
U Zope3/branches/3.3/src/zope/app/publisher/browser/tests/test_icondirective.py
-=-
Modified: Zope3/branches/3.3/doc/CHANGES.txt
===================================================================
--- Zope3/branches/3.3/doc/CHANGES.txt 2006-07-15 19:48:34 UTC (rev 69141)
+++ Zope3/branches/3.3/doc/CHANGES.txt 2006-07-16 14:14:34 UTC (rev 69142)
@@ -10,6 +10,8 @@
Bugfixes
+ - Fixed issue 572: The icon directive title attribute wasn't implemented.
+
- TAL interpreter didn't translate i18n Messages when inserted
as structure;
Modified: Zope3/branches/3.3/src/zope/app/publisher/browser/icon.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/publisher/browser/icon.py 2006-07-15 19:48:34 UTC (rev 69141)
+++ Zope3/branches/3.3/src/zope/app/publisher/browser/icon.py 2006-07-16 14:14:34 UTC (rev 69142)
@@ -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/branches/3.3/src/zope/app/publisher/browser/tests/test_icondirective.py
===================================================================
--- Zope3/branches/3.3/src/zope/app/publisher/browser/tests/test_icondirective.py 2006-07-15 19:48:34 UTC (rev 69141)
+++ Zope3/branches/3.3/src/zope/app/publisher/browser/tests/test_icondirective.py 2006-07-16 14:14:34 UTC (rev 69142)
@@ -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 Zope3-Checkins
mailing list