[Checkins] SVN: zope.testbrowser/trunk/ Define the ``index``
argument of IBrowser.getLink. Revert rev 83809 that
Marius Gedminas
marius at pov.lt
Thu Feb 14 08:33:04 EST 2008
Log message for revision 83831:
Define the ``index`` argument of IBrowser.getLink. Revert rev 83809 that
removed the doctest for its implementation.
Changed:
U zope.testbrowser/trunk/CHANGES.txt
U zope.testbrowser/trunk/src/zope/testbrowser/README.txt
U zope.testbrowser/trunk/src/zope/testbrowser/interfaces.py
-=-
Modified: zope.testbrowser/trunk/CHANGES.txt
===================================================================
--- zope.testbrowser/trunk/CHANGES.txt 2008-02-14 13:15:32 UTC (rev 83830)
+++ zope.testbrowser/trunk/CHANGES.txt 2008-02-14 13:33:04 UTC (rev 83831)
@@ -12,7 +12,7 @@
- Fix https://bugs.launchpad.net/bugs/149517 by adding zope.interface and
zope.schema as real dependencies
-- Fix browser.getLink documentation that was not updated since last API
+- Fix browser.getLink documentation that was not updated since the last API
modification.
Modified: zope.testbrowser/trunk/src/zope/testbrowser/README.txt
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/README.txt 2008-02-14 13:15:32 UTC (rev 83830)
+++ zope.testbrowser/trunk/src/zope/testbrowser/README.txt 2008-02-14 13:33:04 UTC (rev 83831)
@@ -209,16 +209,13 @@
'...Message: <em>By Link Text with Normalization</em>...'
When a link text matches more than one link, by default the first one is
-chosen. In previous versions there was an index parameter that is now
-removed. You can, however, use a regular expression and thus retrieve a
-better matching link:
+chosen. You can, however, specify the index of the link and thus retrieve a
+later matching link:
>>> browser.getLink('Link Text')
<Link text='Link Text' ...>
- >>> import re
- >>> searched_link = re.compile('^Link .* Normalization', re.S|re.M)
- >>> browser.getLink(searched_link)
+ >>> browser.getLink('Link Text', index=1)
<Link text='Link Text with Whitespace Normalization (and parens)' ...>
Note that clicking a link object after its browser page has expired will
@@ -229,7 +226,7 @@
...
ExpiredError
-You can also find the link by its URL or its id,
+You can also find the link by its URL,
>>> browser.open('http://localhost/@@/testbrowser/navigate.html')
>>> browser.contents
Modified: zope.testbrowser/trunk/src/zope/testbrowser/interfaces.py
===================================================================
--- zope.testbrowser/trunk/src/zope/testbrowser/interfaces.py 2008-02-14 13:15:32 UTC (rev 83830)
+++ zope.testbrowser/trunk/src/zope/testbrowser/interfaces.py 2008-02-14 13:33:04 UTC (rev 83831)
@@ -89,7 +89,7 @@
default.
"""
- def getLink(text=None, url=None, id=None):
+ def getLink(text=None, url=None, id=None, index=0):
"""Return an ILink from the page.
The link is found by the arguments of the method. One or more may be
@@ -103,6 +103,10 @@
``href`` attribute of an anchor tag or the action of a form.
o ``id`` -- The id attribute of the anchor tag submit button.
+
+ o ``index`` -- When there's more than one link that matches the
+ text/URL, you can specify which one you want.
+
"""
lastRequestSeconds = schema.Field(
More information about the Checkins
mailing list