Skip to content

Commit

Permalink
use self.tag rather than self.tags
Browse files Browse the repository at this point in the history
  • Loading branch information
atran committed Nov 30, 2020
1 parent 25045f9 commit dc931f6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions rollbar/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1692,23 +1692,23 @@ 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):

if exc_value:
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()
2 changes: 1 addition & 1 deletion rollbar/test/test_feature_flag_context_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -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='[email protected]')

tags = cm.tag
tags = cm.tags
self.assertEqual(len(tags), 3)

key, variation, user = tags
Expand Down

0 comments on commit dc931f6

Please sign in to comment.