Skip to content

Commit

Permalink
raise commanderror instead of returning with print
Browse files Browse the repository at this point in the history
  • Loading branch information
James McKinney committed Nov 29, 2014
1 parent d684c21 commit 3a85f7f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions boundaries/management/commands/compute_intersections.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from optparse import make_option

from django.core.management.base import BaseCommand
from django.core.management.base import BaseCommand, CommandError
from django.utils.six import text_type
from django.utils.translation import ugettext as _, ugettext_lazy

Expand All @@ -14,7 +14,7 @@

class Command(BaseCommand):
help = ugettext_lazy('Create a report of the area of intersection of every pair of boundaries from two boundary sets specified by their slug.')
args = 'boundaryset1 boundaryset2'
args = '<boundary-set-slug> <boundary-set-slug>'

option_list = BaseCommand.option_list + (
make_option('-f', '--format', action='store', dest='format', default="csv",
Expand All @@ -25,8 +25,7 @@ class Command(BaseCommand):

def handle(self, *args, **options):
if len(args) < 2:
print(_("Specify two boundaryset slugs."))
return
raise CommandError(_("Missing boundary set slugs."))

bset_a = BoundarySet.objects.get(slug=args[0])
bset_b = BoundarySet.objects.get(slug=args[1])
Expand Down

0 comments on commit 3a85f7f

Please sign in to comment.