@@ -44,10 +44,10 @@ def get_id(self) -> int:
44
44
"""Returns the id of the resource. This override deals with
45
45
the fact that either an `id` or a `target_project_id` attribute
46
46
is returned by the server depending on the endpoint called."""
47
- try :
48
- return cast ( int , getattr ( self , self . _id_attr ))
49
- except AttributeError :
50
- return cast (int , self .id )
47
+ project_id = cast ( int , super (). get_id ())
48
+ if project_id is not None :
49
+ return project_id
50
+ return cast (int , self .id )
51
51
52
52
53
53
class AllowlistProjectManager (ListMixin , CreateMixin , DeleteMixin , RESTManager ):
@@ -64,10 +64,10 @@ def get_id(self) -> int:
64
64
"""Returns the id of the resource. This override deals with
65
65
the fact that either an `id` or a `target_group_id` attribute
66
66
is returned by the server depending on the endpoint called."""
67
- try :
68
- return cast ( int , getattr ( self , self . _id_attr ))
69
- except AttributeError :
70
- return cast (int , self .id )
67
+ group_id = cast ( int , super (). get_id ())
68
+ if group_id is not None :
69
+ return group_id
70
+ return cast (int , self .id )
71
71
72
72
73
73
class AllowlistGroupManager (ListMixin , CreateMixin , DeleteMixin , RESTManager ):
0 commit comments