Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

Commit a00deda

Browse files
committed
fix(django): Fix django command with data option (#1078)
1 parent 4b0e6f7 commit a00deda

File tree

1 file changed

+8
-1
lines changed
  • raven/contrib/django/management/commands

1 file changed

+8
-1
lines changed

raven/contrib/django/management/commands/raven.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import argparse
1515
import django
16+
import json
1617
import sys
1718
import time
1819

@@ -21,7 +22,13 @@
2122

2223
class StoreJsonAction(argparse.Action):
2324
def __call__(self, parser, namespace, values, option_string=None):
24-
setattr(namespace, self.dest, store_json(values[0]))
25+
try:
26+
value = json.loads(values[0])
27+
except ValueError:
28+
print("Invalid JSON was used for option %s. Received: %s" % (self.dest, values[0]))
29+
sys.exit(1)
30+
31+
setattr(namespace, self.dest, value)
2532

2633

2734
class Command(BaseCommand):

0 commit comments

Comments
 (0)