fix: Don't remove the distribution and sharing_group_id from default_attributes_parameters

pull/171/head
Raphaël Vinot 2018-01-04 12:23:32 +01:00
parent 4b67605367
commit b9718c3fd3
1 changed files with 5 additions and 3 deletions

View File

@ -791,11 +791,13 @@ class MISPObject(AbstractMISP):
self._default_attributes_parameters.pop('to_ids', None) # depends on the value self._default_attributes_parameters.pop('to_ids', None) # depends on the value
self._default_attributes_parameters.pop('deleted', None) # doesn't make sense to pre-set it self._default_attributes_parameters.pop('deleted', None) # doesn't make sense to pre-set it
self._default_attributes_parameters.pop('data', None) # in case the original in a sample or an attachment self._default_attributes_parameters.pop('data', None) # in case the original in a sample or an attachment
self.distribution = self._default_attributes_parameters.pop('distribution', 5)
self.sharing_group_id = self._default_attributes_parameters.pop('sharing_group_id', 0) # Those values are set for the current object, if they exist, but not pop'd because they are still useful for the attributes
self.distribution = self._default_attributes_parameters.get('distribution', 5)
self.sharing_group_id = self._default_attributes_parameters.get('sharing_group_id', 0)
else: else:
self.distribution = 5 # Default to inherit self.distribution = 5 # Default to inherit
self.sharing_group_id = None self.sharing_group_id = 0
self._standalone = standalone self._standalone = standalone
if self._standalone: if self._standalone:
# Mark as non_jsonable because we need to add the references manually after the object(s) have been created # Mark as non_jsonable because we need to add the references manually after the object(s) have been created