-
-
Notifications
You must be signed in to change notification settings - Fork 656
By default don't import 3rd-party Python modules, only stdlib ones. … #857
base: master
Are you sure you want to change the base?
Changes from 4 commits
096245d
7a6a6a7
f339226
55b8dad
6550d8b
049b98b
11c58cd
6125748
5151958
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,14 @@ | |
import os.path | ||
import sys | ||
|
||
from raven.transport.eventlet import EventletHTTPTransport | ||
from raven.transport.gevent import GeventedHTTPTransport | ||
from raven.transport.requests import RequestsHTTPTransport | ||
from raven.transport.twisted import TwistedHTTPTransport | ||
from raven.transport.tornado import TornadoHTTPTransport | ||
from raven.transport.threaded_requests import ThreadedRequestsHTTPTransport | ||
from raven.base import Client | ||
|
||
|
||
collect_ignore = [] | ||
if sys.version_info[0] > 2: | ||
|
@@ -82,3 +90,13 @@ def pytest_configure(config): | |
}], | ||
ALLOWED_HOSTS=['*'], | ||
) | ||
|
||
|
||
|
||
for transport in [EventletHTTPTransport, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. assuming things break without this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sadly yes. The reason is that all tests build clients based on DSN, so a few test cases fail. And I guess using the DSN and registry is part of the things we test, so we can't remove it?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we'd have to update these tests to pass it in directly, but I'd be ok with that in order to remove the legacy compatibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK. Will probably have to wait a few days before I commit more changes, as I'll be travelling today (to PyCon UK) and I don't have a laptop. |
||
GeventedHTTPTransport, | ||
RequestsHTTPTransport, | ||
ThreadedRequestsHTTPTransport, | ||
TwistedHTTPTransport, | ||
TornadoHTTPTransport]: | ||
Client._registry.register_transport(transport) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of note we dont actually need to do this since you can pass transport to the Client() itself. It was purely for backwards compatibility for a period of time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But the problem is that a typical Django setup just adds
raven.contrib.django.raven_compat
to the list of INSTALLED_APPS. If they also have a weird DSN configured, they would need to register the transports in the registry for it to work, as the Django Sentry app creates its own Client() and I honestly have no idea how to customize creation of this Client()...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can actually just pass it into SENTRY_CONFIG via 'transport' (same as all of the other config options).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK then. I guess I can update the documentation to reflect this. Seems cleaner the way you suggest.