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

Use params in _put #54

Closed
wants to merge 1 commit into from
Closed

Use params in _put #54

wants to merge 1 commit into from

Conversation

Sekuraz
Copy link

@Sekuraz Sekuraz commented Aug 14, 2024

We want to control database creation, especially the number of shards and the parameter is lost on this line.

Copy link
Member

@bmario bmario left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, but it's not quite correct just like that.

@@ -246,7 +246,7 @@ async def _get(self) -> JsonDict:
@raises(401, "CouchDB Server Administrator privileges required")
@raises(412, "Database already exists")
async def _put(self, **params: Any) -> JsonDict:
_, json = await self._remote._put(self.endpoint)
_, json = await self._remote._put(self.endpoint, **params)
Copy link
Member

Choose a reason for hiding this comment

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

The _put method has data as the second argument and params shouldn't be expanded. I think it should simply look like this:

Suggested change
_, json = await self._remote._put(self.endpoint, **params)
_, json = await self._remote._put(self.endpoint, params=params)

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, I overlooked that the kwargs are swallowed again in that method, I saw that they were passed along to _request.

What would you think about adding a kwargs parameter there and allow for the same method signature as aiohttp by passing kwargs through from the first call into aiocouch until they reach the couchdb?

Copy link
Author

Choose a reason for hiding this comment

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

Also: I saw that some tests started to fail because the parameters are no longer ignored. Maybe I need to revisit this whole pull request.

@bmario bmario closed this in e4460b3 Aug 16, 2024
@bmario
Copy link
Member

bmario commented Aug 16, 2024

I took the liberty to throw together my own patch for the issue. Passing the query options should work with the new release now.

Passing kwargs down to _request would be quite a big breaking change for that I don't see the benefits. So I'd rather not touch that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants