@@ -77,23 +77,22 @@ def has_for_batch(
7777 actor : User | None = None ,
7878 ) -> Mapping [Project , bool ]:
7979 """
80- Determine in a batch if a feature is enabled.
80+ Determine if a feature is enabled for a batch of objects .
8181
82- This applies the same procedure as ``FeatureManager.has``, but with a
83- performance benefit where the objects being checked all belong to the
84- same organization. The objects are entities (e.g., projects) with the
85- common parent organization, as would be passed individually to ``has``.
82+ This method enables checking a feature for an organization and a collection
83+ of objects (e.g. projects). Feature handlers for batch checks are expected to
84+ subclass `features.BatchFeatureHandler` and implement `has_for_batch` or
85+ `_check_for_batch`. BatchFeatureHandlers will receive a `FeatureCheckBatch`
86+ that contains the organization and object list.
8687
8788 Feature handlers that depend only on organization attributes, and not
8889 on attributes of the individual objects being checked, will generally
89- perform faster if this method is used in preference to ``has``.
90+ perform faster if this method is used in instead of ``has``.
9091
91- The return value is a dictionary with the objects as keys. Each value
92- is what would be returned if the key were passed to ``has`` .
92+ The return value is a dictionary with the objects as keys, and each
93+ value is the result of the feature check on the organization .
9394
94- The entity handler can handle both batch project/organization
95- contexts so it'll likely have an entirely different implementation
96- of this functionality.
95+ This method *does not* work with the `entity_handler`.
9796
9897 >>> FeatureManager.has_for_batch('projects:feature', organization, [project1, project2], actor=request.user)
9998 """
0 commit comments