Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

session() does not restore previous engine if fails #211

Closed
dmlogv opened this issue Sep 13, 2018 · 1 comment
Closed

session() does not restore previous engine if fails #211

dmlogv opened this issue Sep 13, 2018 · 1 comment
Assignees
Labels

Comments

@dmlogv
Copy link

@dmlogv dmlogv commented Sep 13, 2018

When with redmine.session() fails redminelib does not restore previous used engine.

Example:

rm = redminelib.Redmine('https://redmine.intranet')

# Original engine
print(rm.engine)

try:
    with rm.session(impersonate='william_gates'):
        # Masked engine
        print(rm.engine)
        # Some fails
        rm.issue.create(project_id='test', subject='foo')
except redminelib.exceptions.ImpersonateError as e:
    print(e)

# Should be original engine again?
print(rm.engine) 

Output:

<redminelib.engines.sync.SyncEngine object at 0x03D1B9F0>
<redminelib.engines.sync.SyncEngine object at 0x040EBD10>
Impersonate login provided doesn't exist or isn't active
<redminelib.engines.sync.SyncEngine object at 0x040EBD10>
dmlogv added a commit to dmlogv/python-redmine that referenced this issue Sep 13, 2018
Add exception handling for a `session()` and restore original engine if it fails
@maxtepkeev maxtepkeev self-assigned this Sep 13, 2018
@maxtepkeev maxtepkeev added the bug label Sep 13, 2018
@maxtepkeev
Copy link
Owner

@maxtepkeev maxtepkeev commented Sep 13, 2018

Fixed via #212, thanks @dm-logv

@maxtepkeev maxtepkeev closed this Sep 13, 2018
maxtepkeev added a commit that referenced this issue Jan 2, 2019
avgas3 pushed a commit to avgas3/python-redmine that referenced this issue Mar 31, 2021
Add exception handling for a `session()` and restore original engine if it fails
avgas3 pushed a commit to avgas3/python-redmine that referenced this issue Mar 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants