Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getLink now tests regexes using .match, not .search #82

Open
cjwatson opened this issue Nov 9, 2019 · 1 comment
Open

getLink now tests regexes using .match, not .search #82

cjwatson opened this issue Nov 9, 2019 · 1 comment
Labels
compat Compatibility issues due to mechanize -> webtest migration in 5.0.0

Comments

@cjwatson
Copy link
Contributor

cjwatson commented Nov 9, 2019

(I see several open issues about compatibility with the old mechanize-based test browser, so I hope this sort of thing is welcome.)

I'm in the process of migrating a large project (Launchpad) from old versions of zope.testbrowser to version 5.x. One thorn in my side has been that in several places we do something like this:

    edit_status_url = re.compile(r'1.0/\+bug/[0-9]+/\+editstatus')
    browser.getLink(url=edit_status_url).click()

This worked with mechanize because regexes were tested using .search. However, zope.testbrowser now tests them using .match, so the above code has to be more like this:

    edit_status_url = re.compile(r'.*/1.0/\+bug/[0-9]+/\+editstatus')
    browser.getLink(url=edit_status_url).click()

I don't suppose it would be possible to go back to 4.x-compatible behaviour here?

@cjwatson cjwatson added the compat Compatibility issues due to mechanize -> webtest migration in 5.0.0 label Nov 9, 2019
@mgedmin
Copy link
Member

mgedmin commented Nov 9, 2019

I would be inclined to view such a PR favourably. (I might regret that later, if it turns out users are already relying on the new semantics.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compat Compatibility issues due to mechanize -> webtest migration in 5.0.0
Projects
None yet
Development

No branches or pull requests

2 participants