Skip to content

web.safeunicode#12520

Merged
RayBB merged 2 commits into
internetarchive:masterfrom
acaligac:master
May 1, 2026
Merged

web.safeunicode#12520
RayBB merged 2 commits into
internetarchive:masterfrom
acaligac:master

Conversation

@acaligac

@acaligac acaligac commented May 1, 2026

Copy link
Copy Markdown
Contributor

Closes #12513

replaces web.safeunicode w str()
(sorry for the crazy amount of edits the first time around, pre commit added soo many extra fixes when i ran it :))

Stakeholders

@github-project-automation github-project-automation Bot moved this to Waiting Review/Merge from Staff in Ray's Project May 1, 2026
@mekarpeles mekarpeles requested a review from Copilot May 1, 2026 01:01
@mekarpeles

Copy link
Copy Markdown
Member

Thank you for the contribution, @acaligac!

🤖 Copilot has been assigned for an initial review.

@RayBB is assigned to this PR and currently has:

  • 4 open PR(s) of equal or higher priority to review first
PR triage checklist (maintainers / Pam)
  • PR description — not empty; explains what the change does and how to verify it
  • References an issue — PR body contains a #NNN reference
    • Linked issue is triaged — has a Priority: * label (not just Needs: Triage)
    • Linked issue is assigned — has at least one assignee
  • Commit history clean — no WIP/fixup/conflict noise; commit messages are meaningful
  • CI passing — no failing check-runs
  • Test cases present — if the change touches substantive logic, test coverage exists or is explained
  • Proof of testing — PR body includes a description of what was tested, a screenshot, or a video

Note

This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR modernizes the codebase by removing uses of web.safeunicode(...) (a legacy web.py unicode helper) in favor of Python’s built-in str(...), aligning with Python 3 string handling and reducing reliance on deprecated web.py utilities.

Changes:

  • Replaced web.safeunicode(...) with str(...) across the remaining occurrences in the OpenLibrary codebase.
  • Simplified a couple of dict comprehensions while performing the replacement.
  • Updated URL redirect and table-of-contents normalization paths to use str(...).

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
openlibrary/utils/olmemcache.py Uses str(...) for memcache multi-get result keys instead of web.safeunicode(...).
openlibrary/plugins/upstream/utils.py Replaces web.safeunicode(...) with str(...) in HTML and upstream memcache key handling.
openlibrary/plugins/upstream/merge_authors.py Uses str(...) when normalizing table-of-contents row titles.
openlibrary/plugins/ol_infobase.py Uses str(...) when fixing table-of-contents row titles during JSON processing.
openlibrary/core/processors/readableurls.py Uses str(...) for redirect URL concatenation and readable URL path components.

Comment thread openlibrary/plugins/upstream/utils.py

@RayBB RayBB left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening the PR here and no worries about the last one.

This has no functional changes since the code is equal but to be safe anyway I pulled it down and ran locally and deployed to testing. Didn't hit any errors. Also for sanity asked AI to triple check and confirmed it's all good.

@RayBB RayBB merged commit 5925985 into internetarchive:master May 1, 2026
3 checks passed
@github-project-automation github-project-automation Bot moved this from Waiting Review/Merge from Staff to Done in Ray's Project May 1, 2026
Sadashii pushed a commit to Sadashii/openlibrary that referenced this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Replace web.safeunicode with modern Python alternatives

4 participants