Project

General

Profile

Bug #66576

import des rôles: Role.MultipleObjectsReturned: get() returned more than one Role -- it returned 2!

Added by Sentry Io 8 months ago. Updated 5 months ago.

Status:
Nouveau
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
24 June 2022
Due date:
% Done:

0%

Estimated time:
Patch proposed:
No
Planning:
No

Description

https://sentry.entrouvert.org/entrouvert/publik/issues/61888/

Role.MultipleObjectsReturned: get() returned more than one Role -- it returned 2!
(13 additional frame(s) were not displayed)
...
  File "authentic2/data_transfer.py", line 233, in deserialize
    obj = search_role(self._role_d, ou=self._import_context.set_ou)
  File "authentic2/data_transfer.py", line 120, in search_role
    role = Role.objects.get_by_natural_key_json(role_d)
  File "authentic2/natural_key.py", line 121, in get_by_natural_key_json
    return self.get(**get_kwargs)
  File "django/db/models/manager.py", line 82, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "django/db/models/query.py", line 412, in get
    (self.model._meta.object_name, num)

History

#1

Updated by Lauréline Guérin 8 months ago

  • Project changed from Suivi des traces to Authentic 2
#2

Updated by Benjamin Dauvergne 8 months ago

  • Subject changed from Role.MultipleObjectsReturned: get() returned more than one Role -- it returned 2! to import des rôles: Role.MultipleObjectsReturned: get() returned more than one Role -- it returned 2!

Ici on essaye de charger ce descriptif de rôle

{description: '', external_id: '', name: 'Administrateur fonctionnel', ou: {name: 'Modèle', slug: 'hobo-modele', uuid: 'e5e2df72615c43e997fde8fb5e0f78ef'}, service: None, slug: 'administrateur-fonctionnel', uuid: 'c006baaab52a4e648ae5c5591c154a57'}

(en plus dans une ou différente, <OrganizationalUnit 'hobo-essey' 'Essey-lès-Nancy'>).

Comme rien ne correspond, ça régresse jusqu'à ne chercher que sur le slug ce qui foire, plusieurs rôles correspondant, il faut juste intercepter MultipleObjectsReturned ici et ignorer l'erreur, ça finira par tenter une création qui échouera aussi certainement.

#4

Updated by Lauréline Guérin 5 months ago

Also available in: Atom PDF