MCPcopy Create free account
hub / github.com/Flagsmith/flagsmith / save

Method save

api/features/serializers.py:695–721  ·  view source on GitHub ↗
(self, **kwargs)

Source from the content-addressed store, hash-verified

693 return obj.get_feature_state_value(identity=self.context.get("identity"))
694
695 def save(self, **kwargs): # type: ignore[no-untyped-def]
696 try:
697 response = super().save(**kwargs) # type: ignore[no-untyped-call]
698
699 feature_state = self.instance
700 if (
701 not feature_state.identity_id # type: ignore[union-attr]
702 and feature_state.feature.external_resources.exists() # type: ignore[union-attr]
703 and feature_state.environment.project.github_project.exists() # type: ignore[union-attr]
704 and feature_state.environment.project.organisation.github_config.exists() # type: ignore[union-attr]
705 ):
706 call_github_task(
707 organisation_id=feature_state.feature.project.organisation_id, # type: ignore[union-attr]
708 type=GitHubEventType.FLAG_UPDATED.value,
709 feature=feature_state.feature, # type: ignore[union-attr]
710 segment_name=None,
711 url=None,
712 feature_states=[feature_state],
713 )
714
715 if isinstance(feature_state, FeatureState):
716 post_gitlab_state_change_comment_for_feature_state(feature_state)
717
718 return response
719
720 except django.core.exceptions.ValidationError as e:
721 raise serializers.ValidationError(str(e))
722
723 def validate_feature(self, feature): # type: ignore[no-untyped-def]
724 if self.instance and self.instance.feature_id != feature.id: # type: ignore[union-attr]

Callers 13

cloneMethod · 0.45
cloneMethod · 0.45
cloneMethod · 0.45
copy_fromMethod · 0.45
perform_createMethod · 0.45
perform_updateMethod · 0.45
createMethod · 0.45
updateMethod · 0.45

Calls 3

call_github_taskFunction · 0.90
existsMethod · 0.80