Exemplo n.º 1
0
def populate_feeds():
    session = DBSession()
    feeds = [f.split('|') for f in FEEDS]
    with transaction.manager:
        for name, url in feeds:
            f = Feed(name, url)
            session.add(f)
Exemplo n.º 2
0
def populate_passwords():
    session = DBSession()
    password = '******'
    with transaction.manager:
        for user_id in range(1,6):
            pw = Password(user_id, password)
            session.add(pw)
Exemplo n.º 3
0
def populate_venues():
    session = DBSession()
    venues = ['Jackie Dole', 'Thirsty Hippo', 'Town Square Park']
    with transaction.manager:
        for venue in venues:
            v = Venue(1, venue, 1)
            session.add(v)
Exemplo n.º 4
0
def populate_usergroups():
    session = DBSession()
    with transaction.manager:
        admins = [(1, 1)]  # admin user should be 1
        ulist = admins
        for gid, uid in ulist:
            row = UserGroup(gid, uid)
            session.add(row)
Exemplo n.º 5
0
def populate_usergroups():
    session = DBSession()
    with transaction.manager:
        admins = [(1, 1)]  # admin user should be 1
        ulist = admins
        for gid, uid in ulist:
            row = UserGroup(gid, uid)
            session.add(row)
Exemplo n.º 6
0
def populate_sitetext():
    session = DBSession()
    try:
        with transaction.manager:
            page = SiteText("FrontPage", "This is the front page.", type="tutwiki")
            session.add(page)
    except IntegrityError:
        pass
Exemplo n.º 7
0
def populate_groups():
    session = DBSession()
    # I may remove guest group
    groups = ['user', 'host', 'admin', 'guest']
    with transaction.manager:
        for groupname in groups:
            group = Group(groupname)
            session.add(group)
Exemplo n.º 8
0
def populate_batman_venues():
    session = DBSession()
    venues = ['Wayne Manor', 'Bat Cave', 'City Hall']
    with transaction.manager:
        u = session.query(User).filter_by(username='******').one()
    with transaction.manager:
        for v in venues:
            vv = Venue(u.id, v, 1)
            session.add(vv)
Exemplo n.º 9
0
def populate_eventtypes():
    session = DBSession()
    event_types = ['Musical Performance', 'Monthly Special',
                   'Weekly Special', 'Live Performance',
                   "Trader's Market", 'Social Gathering', 'Seminar']
    with transaction.manager:
        for etype in event_types:
            event_type = EventType(etype)
            session.add(event_type)
Exemplo n.º 10
0
def populate_groups():
    session = DBSession()
    groups = ['admin', 'editor', 'manager']
    for gname in groups:
        try:
            with transaction.manager:
                group = Group(gname)
                session.add(group)
        except IntegrityError:
            pass
Exemplo n.º 11
0
def populate_groups():
    session = DBSession()
    groups = ['admin', 'editor', 'manager']
    for gname in groups:
        try:
            with transaction.manager:
                group = Group(gname)
                session.add(group)
        except IntegrityError:
            pass
Exemplo n.º 12
0
def populate_usergroups():
    session = DBSession()
    # I may remove guest group
    #groups = ['user', 'host', 'admin', 'guest']
    users = [(1,u) for u in range(1,6)]
    hosts = [(2,3), (2,4), (2,5), (2,1)]
    admins = [(3,1), (3,2)]
    all_giduid = users + hosts + admins
    with transaction.manager:
        for gid, uid in all_giduid:
            row = UserGroup(gid, uid)
            session.add(row)
Exemplo n.º 13
0
def populate_contacts():
    session = DBSession()
    contacts = [
        ('Joseph', 'Rawson', '*****@*****.**', '(601)-297-2819'),
        ('Greg', 'Prine', '*****@*****.**'),
        ('Clark', 'Kent', '*****@*****.**'),
        ('Bruce', 'Wayne', '*****@*****.**'),
        ('Hattie', 'Hardy', '*****@*****.**')
        ]
    with transaction.manager:
        for contact_args in contacts:
            contact = Contact(*contact_args)
            session.add(contact)
Exemplo n.º 14
0
def populate_locations():
    session = DBSession()
    # locations come first
    # admin must suppy locations
    # since a user has a default audience(location)
    # The default location for bootstrapping
    # is home base of application
    locations = ['Hattiesburg', 'Petal', 'Oak Grove', 'New Orleans', 'Laurel',
                 'Sumrall']
    with transaction.manager:
        for location in locations:
            a = Audience(location)
            session.add(a)
Exemplo n.º 15
0
def populate_users():
    session = DBSession()
    users = [
        ('umeboshi', 1, 'admin'),
        ('gpprine', 2, 'admin'),
        ('superman', 3, 'host'),
        ('batman', 4, 'host'),
        ('hubclerk', 5, 'host')
        ]
    with transaction.manager:
        for uname, id, role in users:
            user = User(uname, id)
            user.role = role
            user.default_audience_id = 1
            session.add(user)
Exemplo n.º 16
0
def populate_users(admin_username):
    from trumpet.security import encrypt_password
    session = DBSession()
    with transaction.manager:
        users = [admin_username]
        # Using id_count to presume
        # the user's id, which should work
        # when filling an empty database.
        id_count = 0
        for uname in users:
            id_count += 1
            user = User(uname)
            password = encrypt_password(uname)
            session.add(user)
            pw = Password(id_count, password)
            session.add(pw)