From d997df9bde8f01913b1bfbf03d798fa656c9f67c Mon Sep 17 00:00:00 2001 From: Satellite QE <115476073+Satellite-QE@users.noreply.github.com> Date: Tue, 28 May 2024 15:24:58 -0400 Subject: [PATCH] Use type(self) instead of entity class name in create methods. (#1144) (cherry picked from commit d5545c17d2fd32deddc9ebe69ae29c9637f76467) Co-authored-by: Tasos Papaioannou --- nailgun/entities.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/nailgun/entities.py b/nailgun/entities.py index 20601ffc..94cec230 100644 --- a/nailgun/entities.py +++ b/nailgun/entities.py @@ -1582,7 +1582,7 @@ def create(self, create_missing=None): `_. """ - return DiscoveryRule( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -3150,7 +3150,7 @@ def create(self, create_missing=None): `_. """ - return Domain( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -3644,7 +3644,7 @@ def create(self, create_missing=None): `_. """ - return HostCollection( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -3724,7 +3724,7 @@ def create(self, create_missing=None): `_. """ - return HostGroup( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -4364,7 +4364,7 @@ def create(self, create_missing=None): For more information, see `Bugzilla #1449749 `_. """ - return Host( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -5417,7 +5417,7 @@ def create(self, create_missing=None): """ attrs = self.create_json(create_missing) - return Location(self._server_config, id=attrs['id']).read() + return type(self)(self._server_config, id=attrs['id']).read() def read(self, entity=None, attrs=None, ignore=None, params=None): """Work around a bug in the server's response. @@ -5494,7 +5494,7 @@ def create(self, create_missing=None): `_. """ - return Media( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -5759,7 +5759,7 @@ def create(self, create_missing=None): `_. """ - return Organization( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -6620,7 +6620,7 @@ def create(self, create_missing=None): `_. """ - return Realm( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -8200,7 +8200,7 @@ def create(self, create_missing=None): `_. """ - return TailoringFile( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -8371,7 +8371,7 @@ def create(self, create_missing=None): `_. """ - return UserGroup( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -8648,7 +8648,7 @@ def create(self, create_missing=None): `_. """ - return ScapContents( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read() @@ -8767,7 +8767,7 @@ def create(self, create_missing=None): """ self._fields['event'] = entity_fields.StringField(required=True, choices=self.get_events()) - return Webhooks( + return type(self)( self._server_config, id=self.create_json(create_missing)['id'], ).read()