Skip to content

Version 5.3 breaks how teams output is returned by the API #168

@mhxion

Description

@mhxion

This is likely happening due to teams no longer returning a valid JSON, but rather a pure string (where JSON syntax is escaped) and thus is not de-serialized to Python dictionary. Was this intentional?!

# 5.3:
  "teams": "[{\"id\": 51, \"name\": \"MedFaculty Demo\", \"is_admin\": 0, \"is_owner\": 0, \"is_archived\": 0}, {\"id\": 4, \"name\": \"FOO BAR\", \"is_admin\": 0, \"is_owner\": 0, \"is_archived\": 0}]",
  "team": 1
}

# Before:

  "teams": [
    {
      "id": 3,
      "name": "Foo",
      "usergroup": 4,
      "is_owner": 0
    }
  ]
}

The bill-teams, whoami will throw the following error:

│    52 │   scope_experiments_templates = user_info["scope_experiments_templates"]                 │
│    53 │   scope_teamgroups = user_info["scope_teamgroups"]                                       │
│    54 │   for user_team in user_all_teams:                                                       │
│ ❱  55 │   │   if user_team["id"] == user_team_id:                                                │
│    56 │   │   │   user_team_name = user_team["name"]                                             │
│    57 │   │   │   user_group = user_team["usergroup"]                                            │
│    58 │   │   │   break                                                                          │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: string indices must be integers, not 'str'

Reported by @alexander-haller

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcriticalCriticul issue

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions