GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Pull Request — master (#5)
by Bastien
01:09
created

pyjobsweb.websetup.bootstrap()   B

Complexity

Conditions 2

Size

Total Lines 45

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 45
rs 8.8571
cc 2
1
# -*- coding: utf-8 -*-
2
"""Setup the pyjobsweb application"""
3
from __future__ import print_function, unicode_literals
4
import transaction
5
from pyjobsweb import model
6
7
8
def bootstrap(command, conf, vars):
9
    """Place any commands to setup pyjobsweb here"""
10
11
    # <websetup.bootstrap.before.auth
12
    from sqlalchemy.exc import IntegrityError
13
    try:
14
        u = model.User()
15
        u.user_name = 'manager'
16
        u.display_name = 'Example manager'
17
        u.email_address = '[email protected]'
18
        u.password = 'managepass'
19
20
        model.DBSession.add(u)
21
22
        g = model.Group()
23
        g.group_name = 'managers'
24
        g.display_name = 'Managers Group'
25
26
        g.users.append(u)
27
28
        model.DBSession.add(g)
29
30
        p = model.Permission()
31
        p.permission_name = 'manage'
32
        p.description = 'This permission gives an administrative right'
33
        p.groups.append(g)
34
35
        model.DBSession.add(p)
36
37
        u1 = model.User()
38
        u1.user_name = 'editor'
39
        u1.display_name = 'Example editor'
40
        u1.email_address = '[email protected]'
41
        u1.password = 'editpass'
42
43
        model.DBSession.add(u1)
44
        model.DBSession.flush()
45
        transaction.commit()
46
    except IntegrityError:
47
        print('Warning, there was a problem adding your auth data, '
48
              'it may have already been added:')
49
        import traceback
50
        print(traceback.format_exc())
51
        transaction.abort()
52
        print('Continuing with bootstrapping...')
53
54
    # <websetup.bootstrap.after.auth>
55