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

FIX when raven unavailable #881

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions sentry/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import raven
from raven.conf import defaults
except ImportError:
raven = False
_logger.debug('Cannot import "raven". Please make sure it is installed.')


Expand All @@ -34,10 +35,10 @@ def split_multiple(string, delimiter=',', strip_chars=None):

DEFAULT_TRANSPORT = 'threaded'
TRANSPORT_CLASS_MAP = {
'requests_synchronous': raven.transport.RequestsHTTPTransport,
'requests_threaded': raven.transport.ThreadedRequestsHTTPTransport,
'synchronous': raven.transport.HTTPTransport,
'threaded': raven.transport.ThreadedHTTPTransport,
'requests_synchronous': getattr(raven, 'transport.RequestsHTTPTransport', False),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getattr is not recursive AFAIK. Better to move this to try section

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or add raven_import = True in try and False in exception and then add a conditional dict

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's another possibility

'requests_threaded': getattr(raven, 'transport.ThreadedRequestsHTTPTransport', False),
'synchronous': getattr(raven, 'transport.HTTPTransport', False),
'threaded': getattr(raven, 'transport.ThreadedHTTPTransport', False),
}

ODOO_USER_EXCEPTIONS = [
Expand Down