atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

[Confluence] confluence.remove_page() method may not remove all child pages.

Open hograthm opened this issue 3 years ago • 8 comments

Sometimes methond confluence.remove_page() with parameter recursive=True can't delete all child pages. Instead it will delete only fixed number of child pages and delete a root page. All remaining child pages will be moved to the root of the space. This is possible because inside confluence.remove_page() we use confluence.get_page_child_by_type() https://github.com/atlassian-api/atlassian-python-api/blob/523057ceb1cc6b1c807816c7acf3dd255f0b4e0d/atlassian/confluence.py#L60-L69 By default limit=None, but In my case it was 25 by default. This led to an incorrect amount of executions here: https://github.com/atlassian-api/atlassian-python-api/blob/523057ceb1cc6b1c807816c7acf3dd255f0b4e0d/atlassian/confluence.py#L579-L582 At the moment, I still have not trace what forces limit to take default value 25. Maybe this is a bug.

hograthm avatar Feb 02 '22 12:02 hograthm

There is also a limit on the server side. The user can't increase this.

Spacetown avatar Feb 02 '22 16:02 Spacetown

@Spacetown I was able to increase it manually from 25 to 200 without any error messages from server side. That's why I think 25 is hard coded somewhere. As I see this - we need some function to get this server-side limit and apply it as default one, but I'm not sure if Confluence have something like this. Will check it and then return with my research here.

hograthm avatar Feb 02 '22 18:02 hograthm

In my opinion it was wrong to add the arguments start=None, limit=None to the function The paged APIS need to be called in a special way and this should be handled by the module and not by the user.

See also #935 where a normal getwas replaced by a _get_paged which is doing the paging stuff and yields each item to the user. https://github.com/atlassian-api/atlassian-python-api/blob/523057ceb1cc6b1c807816c7acf3dd255f0b4e0d/atlassian/bitbucket/init.py#L2333-L2343 https://github.com/atlassian-api/atlassian-python-api/blob/523057ceb1cc6b1c807816c7acf3dd255f0b4e0d/atlassian/bitbucket/base.py#L41-L81

Spacetown avatar Feb 02 '22 19:02 Spacetown