From dc931f66dfa0d72d1816008aadc33415d8fc6a65 Mon Sep 17 00:00:00 2001 From: atran Date: Mon, 30 Nov 2020 11:32:30 -0800 Subject: [PATCH] use self.tag rather than self.tags --- rollbar/__init__.py | 12 ++++++------ rollbar/test/test_feature_flag_context_manager.py | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/rollbar/__init__.py b/rollbar/__init__.py index ceaa2ee0..e26bc86c 100644 --- a/rollbar/__init__.py +++ b/rollbar/__init__.py @@ -1692,16 +1692,16 @@ class _TagManager(object): """ Context manager object that interfaces with the `_tags` stack: - On enter, puts the tag object at top of the stack. + On enter, puts the tags at top of the stack. On exit, pops off the top element of the stack. - - If there is an exception, attach the tag object to the exception + - If there is an exception, attach the tags to the exception for rebuilding of the `_tags` stack before reporting. """ - def __init__(self, tag): - self.tag = tag + def __init__(self, tags): + self.tags = tags def __enter__(self): - _tags.append(self.tag) + _tags.append(self.tags) def __exit__(self, exc_type, exc_value, traceback): @@ -1709,6 +1709,6 @@ def __exit__(self, exc_type, exc_value, traceback): if not hasattr(exc_value, '_rollbar_tags'): exc_value._rollbar_tags = [] - exc_value._rollbar_tags.append(self.tag) + exc_value._rollbar_tags.append(self.tags) _tags.pop() diff --git a/rollbar/test/test_feature_flag_context_manager.py b/rollbar/test/test_feature_flag_context_manager.py index 7f8f5923..b549b29d 100644 --- a/rollbar/test/test_feature_flag_context_manager.py +++ b/rollbar/test/test_feature_flag_context_manager.py @@ -23,7 +23,7 @@ def setUp(self): def test_feature_flag_generates_correct_tag_payload(self): cm = rollbar.feature_flag('feature-foo', variation=True, user='atran@rollbar.com') - tags = cm.tag + tags = cm.tags self.assertEqual(len(tags), 3) key, variation, user = tags