Command.handle()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 7

Duplication

Lines 7
Ratio 100 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 7
loc 7
rs 9.4285
cc 2
1
from django.core.management.base import BaseCommand
2
from django.contrib.auth.models import User, Group
3
4
from opensubmit.security import make_owner
5
6 View Code Duplication
class Command(BaseCommand):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
7
    help = 'Makes the given user a course owner.'
8
9
    def add_arguments(self, parser):
10
        parser.add_argument('email', nargs=1, type=str)
11
12
    def handle(self, *args, **options):
13
        try:
14
            u=User.objects.get(email=options['email'][0])
15
            print("Found %s %s (%s), activating course owner rights."%(u.first_name, u.last_name, u.email))
16
            make_owner(u)
17
        except User.DoesNotExist:
18
            print("This user does not exist.")
19