You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Confluence class has several functions documented to return a specific type. However, when a target page does not exist the function will log an error and return None. This behavior is not always documented for the user to expect/check.
Confluence.get_page_by_title will intercept an error and return None, which is documented for the user.
log.error("Can't find '%s' page on the %s!", title, self.url)
log.debug(e)
returnNone
Confluence.get_tables_from_page will return a dictionary with a completely different key structure which isn't documented. Either the same structure should be followed with "number_of_tables_in_page" set to 0 or an exception should be raised.
These are just a small sample of functions where behavior diverges from the documentation or unnecessarily changes the return type. I would suggest either:
Raising an exception when a target page does not exist (similar to an ApiNotFoundError, but as a new unique exception). However this would break backwards-compatibility for existing users.
Correcting function documentation to warn of the varying return types and/or normalizing structure of certain returns (e.g. dict for Confluence.get_tables_from_page using same keys).
The text was updated successfully, but these errors were encountered:
kamakazikamikaze
changed the title
Return behavior of functions should be normalized to establish expected behavior
Return behavior of functions should be normalized
Aug 23, 2024
The
Confluence
class has several functions documented to return a specific type. However, when a target page does not exist the function will log an error and returnNone
. This behavior is not always documented for the user to expect/check.Confluence.get_page_by_title
will intercept an error and returnNone
, which is documented for the user.atlassian-python-api/atlassian/confluence.py
Lines 275 to 288 in 63c2faf
atlassian-python-api/atlassian/confluence.py
Lines 314 to 319 in 63c2faf
Confluence.get_tables_from_page
will return a dictionary with a completely different key structure which isn't documented. Either the same structure should be followed with"number_of_tables_in_page"
set to0
or an exception should be raised.atlassian-python-api/atlassian/confluence.py
Lines 374 to 385 in 63c2faf
Confluence.attach_content
will return the API response upon success orNone
when a target page does not exist. This is not documented.atlassian-python-api/atlassian/confluence.py
Lines 1265 to 1268 in 63c2faf
Confluence.download_attachments_from_page
returns astr
if no attachments are found, otherwise it returns adict
.Confluence.update_page
will returnNone
if page does not exist. This is not documented for the user.atlassian-python-api/atlassian/confluence.py
Lines 1725 to 1728 in 63c2faf
These are just a small sample of functions where behavior diverges from the documentation or unnecessarily changes the return type. I would suggest either:
ApiNotFoundError
, but as a new unique exception). However this would break backwards-compatibility for existing users.dict
forConfluence.get_tables_from_page
using same keys).The text was updated successfully, but these errors were encountered: