Browse Source

fix(cli): fix error with command django send_fake_data (#24250)

Eliminates raven dependency on send_fake_data.py and imports the client from sentry.app instead of raven.contrib.django.models.

Fixes #10645, supercedes #14138.
Burak Yigit Kaya 4 years ago
parent
commit
456367bfe4
1 changed files with 8 additions and 10 deletions
  1. 8 10
      src/sentry/management/commands/send_fake_data.py

+ 8 - 10
src/sentry/management/commands/send_fake_data.py

@@ -28,16 +28,14 @@ def funcs():
         )
         try:
             raise next(exceptions)
-        except Exception:
+        except Exception as exc:
             email = next(emails)
-            return client.captureException(
-                data={
-                    "logger": next(loggers),
-                    "site": "web",
-                    "user": {"id": email, "email": email},
-                },
-                date=timestamp,
-            )
+            with client.configure_scope() as scope:
+                scope.user = {"id": email, "email": email}
+                scope.logger = next(loggers)
+                scope.site = "web"
+                scope.date = timestamp
+                return client.captureException(exc)
 
     return [exception]
 
@@ -53,7 +51,7 @@ class Command(BaseCommand):
 
     def handle(self, **options):
         from django.conf import settings
-        from raven.contrib.django.models import client
+        from sentry.app import client
         from sentry.models import Project
 
         if not options["project"]: