@@ -203,7 +203,8 @@ def _get_feature_variable_for_type(self, feature_key, variable_key, variable_typ
203
203
if not variable :
204
204
return None
205
205
206
- # Return None if type differs
206
+ # For non-typed method, use type of variable; else, return None if type differs
207
+ variable_type = variable_type or variable .type
207
208
if variable .type != variable_type :
208
209
self .logger .warning (
209
210
'Requested variable type "%s", but variable is of type "%s". '
@@ -513,6 +514,23 @@ def get_enabled_features(self, user_id, attributes=None):
513
514
514
515
return enabled_features
515
516
517
+ def get_feature_variable (self , feature_key , variable_key , user_id , attributes = None ):
518
+ """ Returns value for a variable attached to a feature flag.
519
+
520
+ Args:
521
+ feature_key: Key of the feature whose variable's value is being accessed.
522
+ variable_key: Key of the variable whose value is to be accessed.
523
+ user_id: ID for user.
524
+ attributes: Dict representing user attributes.
525
+
526
+ Returns:
527
+ Value of the variable. None if:
528
+ - Feature key is invalid.
529
+ - Variable key is invalid.
530
+ """
531
+
532
+ return self ._get_feature_variable_for_type (feature_key , variable_key , None , user_id , attributes )
533
+
516
534
def get_feature_variable_boolean (self , feature_key , variable_key , user_id , attributes = None ):
517
535
""" Returns value for a certain boolean variable attached to a feature flag.
518
536
0 commit comments