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

Another batch of SA2.0 edits in TS2.0 (part 3) #16833

Merged
merged 22 commits into from Oct 17, 2023

Conversation

jdavcs
Copy link
Member

@jdavcs jdavcs commented Oct 11, 2023

SQLAlchemy 2.0 compatibility. Follow up to #16799. Ref #12541.

How to test the changes?

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@jdavcs jdavcs added kind/refactoring cleanup or refactoring of existing code, no functional changes area/toolshed area/database Galaxy's database or data access layer labels Oct 11, 2023
@jdavcs jdavcs added this to the 23.2 milestone Oct 11, 2023
@@ -1107,3 +1066,39 @@ def _get_changeset_revisions_that_contain_tools(app: "ToolShedApp", repo, reposi
if metadata.get("tools", None):
changeset_revisions_that_contain_tools.append(changeset_revision)
return changeset_revisions_that_contain_tools


def get_user_by_username(session, username, user_model):
Copy link
Member

@bgruening bgruening Oct 12, 2023

Choose a reason for hiding this comment

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

Why is the user_model here the third and below it always the second argument?
Does the model really need to be passed in? Can we not assume it has the user model by the function name?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hmm.. I passed all those models to these functions because in a different module directly importing them from tool_shed.webapp.model raised an error due to a circular dependency. However, those were modules in util, but this is in managers, so there should be no error from an import. Let me clean this up a bit (I hate passing those models).

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not reusing the function from galaxy.managers.users because that one calls first(), whereas this one calls one(), so the behavior is slightly different. Most likely the difference is inconsequential, but with the tool shed I cannot be sure. And the calling code would have to be slightly adjusted. Given the scale of these changes, I'm trying to minimize my footprint here.

RepositoryMetadata is mapped imperatively, so until the mapper creates
attributes based on Column definitions, the attribute does not exist on
the class. This class is mapped imperatively due to the complications
triggered by mapping the "metadata" attribute.
@jdavcs jdavcs marked this pull request as ready for review October 13, 2023 13:06
@jdavcs
Copy link
Member Author

jdavcs commented Oct 13, 2023

This is ready for review.

@jdavcs jdavcs requested a review from a team October 13, 2023 13:09
@jmchilton jmchilton merged commit 9798e9d into galaxyproject:dev Oct 17, 2023
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/database Galaxy's database or data access layer area/toolshed kind/refactoring cleanup or refactoring of existing code, no functional changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants