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

Method is_feature_name_valid

api/projects/models.py:200–211  ·  view source on GitHub ↗

Validate the feature name based on the feature_name_regex attribute. Since we always want to evaluate the regex against the whole string, we're wrapping the attribute value in ^(...)$. Note that ^(...)$ and ^^(...)$$ are equivalent (in case the attribute already has

(self, feature_name: str)

Source from the content-addressed store, hash-verified

198 return Segment.live_objects.filter(project=self).count() # type: ignore[no-any-return]
199
200 def is_feature_name_valid(self, feature_name: str) -> bool:
201 """
202 Validate the feature name based on the feature_name_regex attribute.
203
204 Since we always want to evaluate the regex against the whole string, we're wrapping the
205 attribute value in ^(...)$. Note that ^(...)$ and ^^(...)$$ are equivalent (in case the
206 attribute already has the boundaries defined)
207 """
208 return (
209 not self.feature_name_regex
210 or re.match(f"^{self.feature_name_regex}$", feature_name) is not None
211 )
212
213 @property
214 def show_edge_identity_overrides_for_feature(self) -> bool:

Calls

no outgoing calls