~nuclearbob/qlbr/add-dash-server

« back to all changes in this revision

Viewing changes to qlbr/management/commands/get_task_data.py

  • Committer: Max Brustkern
  • Date: 2014-08-19 16:27:33 UTC
  • Revision ID: max@canonical.com-20140819162733-lcb5ryjy0ym4z4lm
Added private search capability and Barajas project

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import datetime
19
19
import logging
 
20
from optparse import make_option
20
21
 
21
22
from django.core.exceptions import ObjectDoesNotExist
 
23
from django.core.management.base import BaseCommand
 
24
 
 
25
from launchpadlib.launchpad import Launchpad
22
26
 
23
27
from qlbr import TZ
24
28
from qlbr.management.commands import LaunchpadCommand
25
29
from qlbr.models import Bug, Person, Search, SearchTag, Tag, Task
 
30
from qlbr.settings import CACHEDIR
26
31
 
27
32
logger = logging.getLogger(__name__)
28
33
RUN_START = datetime.datetime.now(TZ)
32
37
 
33
38
    """Provide data slurping commands."""
34
39
 
 
40
    option_list = BaseCommand.option_list + (
 
41
        make_option('--reload',
 
42
                    action='store_true',
 
43
                    dest='reload',
 
44
                    default=False,
 
45
                    help='Reload all task data',
 
46
                    ),
 
47
        make_option('--credentials_file',
 
48
                    action='store',
 
49
                    dest='credentials_file',
 
50
                    help='Credentials file for authenticated LP access.',
 
51
                    ),
 
52
    )
 
53
 
35
54
    def get_person(self, person_link):
36
55
        """Get a person from launchpad if we don't already have it.
37
56
 
200
219
            self.reload = True
201
220
        else:
202
221
            self.reload = False
 
222
        if 'credentials_file' in options:
 
223
            self.lp = Launchpad.login_with(
 
224
                'QA Reports', 'production', CACHEDIR,
 
225
                credentials_file=options['credentials_file'])
203
226
        self.search_tasks()