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

Make the better URL feature work properly #787

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions activities.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,11 @@ def fetch_spec_data(self, url):
try:
spec_data = self.parser().parse(soup, url)
except BetterUrl as why:
new_url = str(why)
sys.stderr.write("* Trying <%s>...\n" % new_url)
if why.args[0] == url:
sys.stderr.write("*** BUG: proposing the same URL as better.\n")
raise why
new_url = why.args[0]
sys.stderr.write("* Using better URL: <%s>...\n" % new_url)
spec_data = self.fetch_spec_data(new_url)
except FetchError:
sys.stderr.write("* Falling back.\n")
Expand Down Expand Up @@ -434,9 +437,9 @@ def parse(self, spec, url_string):
this_url = self.get_link(spec, "^This version")
latest_url = self.get_link(spec, "^Latest version")
ed_url = self.get_link(spec, "^Editor's draft")
if ed_url and ed_url != this_url:
if ed_url and ed_url != url_string:
raise BetterUrl(ed_url)
elif latest_url and latest_url != this_url:
elif latest_url and latest_url != url_string:
raise BetterUrl(latest_url)
elif this_url:
data["url"] = this_url
Expand Down
Loading