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

list items should return "None" when there are no items to list #23

Open
bradh11 opened this issue May 13, 2022 · 0 comments
Open

list items should return "None" when there are no items to list #23

bradh11 opened this issue May 13, 2022 · 0 comments

Comments

@bradh11
Copy link
Collaborator

bradh11 commented May 13, 2022

Current behavior for most methods is to Fault with a "None is not subscriptable: when running a method to get a list of items (if no items exist). The fix will require changing from

    def get_sip_trunks(
        self, tagfilter={"name": "", "sipProfileName": "", "callingSearchSpaceName": ""}
    ):
        try:
            return self.client.listSipTrunk({"name": "%"}, returnedTags=tagfilter)[
                "return"
            ]["sipTrunk"]
        except Fault as e:
            return e

and change it to the following:

    def get_sip_trunks(
        self, tagfilter={"name": "", "sipProfileName": "", "callingSearchSpaceName": ""}
    ):
        try:
            response = self.client.listSipTrunk({"name": "%"}, returnedTags=tagfilter)["return"]
            if response:
                return response["sipTrunk"]
            else:
                return response
        except Fault as e:
            return e

this would need to be done for all methods to list items

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

No branches or pull requests

1 participant