示例#1
0
文件: replay.py 项目: lansolo99/pyvac
def replay(settings):

    with open(settings['pyvac.celery.yaml']) as fdesc:
        Conf = yaml.load(fdesc, YAMLLoader)
    caldav_url = Conf.get('caldav').get('url')

    # XXX Register the database
    create_engine(settings, scoped=True)
    session = DBSession()

    calendar = get_calendar(caldav_url)
    requests = Request.find(session,
                            where=(Request.status == 'APPROVED_ADMIN',),
                            order_by=Request.user_id)
    print 'total requests', len(requests)
    print ''

    req_to_add = []

    # for each requests
    for req in requests:
        print '-' * 10
        print req.id, req.summarycal, req.date_from, req.date_to
        # check if entry in caldav exists
        results = calendar.date_search(req.date_from, req.date_to)
        if not results:
            # need to add missing entry in caldav
            print 'need to insert request'
            req_to_add.append(req.id)
        else:
            summaries = []
            for event in results:
                try:
                    parse_event(event)
                except Exception:
                    continue
                event.load()
                # XXX: if needed to delete entries
                # uid = event.instance.vevent.uid.value
                # ics = '%s/%s.ics' % (caldav_url, uid)
                # print delFromCal(caldav_url, ics)
                summary = event.instance.vevent.summary.value
                summaries.append(summary)
            if req.summarycal not in summaries:
                print 'need to insert request'
                req_to_add.append(req.id)

    for req_id in set(req_to_add):
        req = Request.by_id(session, req_id)
        print 'processing', req.id, req.summarycal, req.date_from, req.date_to
        ics_url = addToCal(caldav_url,
                           req.date_from,
                           req.date_to,
                           req.summarycal)
        # save ics url in request
        req.ics_url = ics_url
        session.add(req)

    session.flush()
    transaction.commit()
示例#2
0
文件: replay.py 项目: doyousoft/pyvac
def replay(settings):

    with open(settings["pyvac.celery.yaml"]) as fdesc:
        Conf = yaml.load(fdesc, YAMLLoader)
    caldav_url = Conf.get("caldav").get("url")

    # XXX Register the database
    create_engine(settings, scoped=True)
    session = DBSession()

    calendar = get_calendar(caldav_url)
    requests = Request.find(session, where=(Request.status == "APPROVED_ADMIN",), order_by=Request.user_id)
    print "total requests", len(requests)
    print ""

    req_to_add = []

    # for each requests
    for req in requests:
        print "-" * 10
        print req.id, req.summarycal, req.date_from, req.date_to
        # check if entry in caldav exists
        results = calendar.date_search(req.date_from, req.date_to)
        if not results:
            # need to add missing entry in caldav
            print "need to insert request"
            req_to_add.append(req.id)
        else:
            summaries = []
            for event in results:
                try:
                    parse_event(event)
                except Exception:
                    continue
                event.load()
                # XXX: if needed to delete entries
                # uid = event.instance.vevent.uid.value
                # ics = '%s/%s.ics' % (caldav_url, uid)
                # print delFromCal(caldav_url, ics)
                summary = event.instance.vevent.summary.value
                summaries.append(summary)
            if req.summarycal not in summaries:
                print "need to insert request"
                req_to_add.append(req.id)

    for req_id in set(req_to_add):
        req = Request.by_id(session, req_id)
        print "processing", req.id, req.summarycal, req.date_from, req.date_to
        ics_url = addToCal(caldav_url, req.date_from, req.date_to, req.summarycal)
        # save ics url in request
        req.ics_url = ics_url
        session.add(req)

    session.flush()
    transaction.commit()
示例#3
0
def setUpModule():

    engine = create_engine(settings)
    populate(engine)

    session = DBSession()
    user_group = Group.by_name(session, 'user')
    manager_group = Group.by_name(session, 'manager')
    sudoer_group = Group.by_name(session, 'sudoer')
    common_password = '******'

    cp_vacation = VacationType.by_name(session, 'CP')
    rtt_vacation = VacationType.by_name(session, 'RTT')
    recovery_vacation = VacationType.by_name(session, 'Récupération')
    sickness_vacation = VacationType.by_name(session, 'Maladie')
    exception_vacation = VacationType.by_name(session, 'Exceptionnel')

    fr_country = Countries.by_name(session, 'fr')
    us_country = Countries.by_name(session, 'us')
    lu_country = Countries.by_name(session, 'lu')

    manager1 = User(
        login='******',
        password=common_password,
        email='*****@*****.**',
        firstname='First',
        lastname='Manager',
        role='manager',
        _country=fr_country,
    )
    manager1.groups.append(manager_group)
    session.add(manager1)

    manager2 = User(
        login='******',
        password=common_password,
        email='*****@*****.**',
        firstname='Second',
        lastname='Manager',
        role='manager',
        _country=fr_country,
    )
    manager2.groups.append(manager_group)
    session.add(manager2)

    manager_us = User(
        login='******',
        password=common_password,
        email='*****@*****.**',
        firstname='Third',
        lastname='Manager',
        role='manager',
        _country=us_country,
    )
    manager_us.groups.append(manager_group)
    session.add(manager_us)

    user1 = User(
        login='******',
        password=common_password,
        email='*****@*****.**',
        manager=manager1,
        firstname='John',
        lastname='Doe',
        _country=fr_country,
        registration_number=1337,
    )
    user1.groups.append(user_group)
    session.add(user1)

    user2 = User(
        login='******',
        password=common_password,
        email='*****@*****.**',
        manager=manager2,
        firstname='Jane',
        lastname='Doe',
        _country=fr_country,
    )
    user2.groups.append(user_group)
    user2.groups.append(sudoer_group)
    session.add(user2)

    session.flush()
    sudoer = Sudoer(source_id=user2.id, target_id=1)
    session.add(sudoer)

    user3 = User(
        login='******',
        password=common_password,
        email='*****@*****.**',
        manager=manager1,
        firstname='Sarah',
        lastname='Doe',
        _country=lu_country,
    )
    user3.groups.append(user_group)
    session.add(user3)

    date_from = datetime.strptime('10/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('14/04/2015', '%d/%m/%Y')
    req1 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=cp_vacation,
                   status='PENDING',
                   user=user1,
                   notified=False)
    session.add(req1)

    date_from = datetime.strptime('10/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('21/04/2015', '%d/%m/%Y')
    req2 = Request(
        date_from=date_from,
        date_to=date_to,
        days=10,
        vacation_type=cp_vacation,
        status='PENDING',
        user=user2,
        notified=False,
    )
    session.add(req2)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req3 = Request(
        date_from=date_from,
        date_to=date_to,
        days=5,
        vacation_type=rtt_vacation,
        status='ACCEPTED_MANAGER',
        user=user1,
        notified=True,
    )
    session.add(req3)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req4 = Request(
        date_from=date_from,
        date_to=date_to,
        days=5,
        vacation_type=rtt_vacation,
        status='CANCELED',
        user=user1,
        notified=True,
    )
    session.add(req4)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req5 = Request(
        date_from=date_from,
        date_to=date_to,
        days=5,
        vacation_type=rtt_vacation,
        status='APPROVED_ADMIN',
        user=manager_us,
        notified=True,
    )
    session.add(req5)

    date_from = datetime.strptime('24/08/2011', '%d/%m/%Y')
    date_to = datetime.strptime('24/08/2011', '%d/%m/%Y')
    req6 = Request(date_from=date_from,
                   date_to=date_to,
                   days=0.5,
                   vacation_type=rtt_vacation,
                   status='APPROVED_ADMIN',
                   user=user1,
                   notified=True,
                   label='AM')
    session.add(req6)

    date_from = datetime.strptime('14/07/2014', '%d/%m/%Y')
    date_to = datetime.strptime('14/07/2014', '%d/%m/%Y')
    req7 = Request(date_from=date_from,
                   date_to=date_to,
                   days=0.5,
                   vacation_type=rtt_vacation,
                   status='APPROVED_ADMIN',
                   user=user1,
                   notified=True,
                   label='AM')
    session.add(req7)

    # used for rtt vacation checks

    date_from = datetime.strptime('01/04/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/04/2016', '%d/%m/%Y')
    req8 = Request(date_from=date_from,
                   date_to=date_to,
                   days=1,
                   vacation_type=rtt_vacation,
                   status='PENDING',
                   user=user1,
                   notified=True)
    session.add(req8)

    date_from = datetime.strptime('01/03/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/03/2016', '%d/%m/%Y')
    req9 = Request(date_from=date_from,
                   date_to=date_to,
                   days=1,
                   vacation_type=rtt_vacation,
                   status='ACCEPTED_MANAGER',
                   user=user1,
                   notified=True)
    session.add(req9)

    date_from = datetime.strptime('01/02/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/02/2016', '%d/%m/%Y')
    req10 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=rtt_vacation,
                    status='APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req10)

    date_from = datetime.strptime('01/06/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/06/2016', '%d/%m/%Y')
    req11 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=recovery_vacation,
                    status='APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req11)

    date_from = datetime.strptime('12/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('12/04/2015', '%d/%m/%Y')
    req12 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=rtt_vacation,
                    status='DENIED',
                    user=user1,
                    notified=True)
    session.add(req12)

    date_from = datetime.strptime('06/06/2016', '%d/%m/%Y')
    date_to = datetime.strptime('06/06/2016', '%d/%m/%Y')
    req13 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=sickness_vacation,
                    status='APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req13)

    date_from = datetime.strptime('13/06/2016', '%d/%m/%Y')
    date_to = datetime.strptime('13/06/2016', '%d/%m/%Y')
    req14 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=exception_vacation,
                    status='APPROVED_ADMIN',
                    user=user2,
                    message="I need to see Star Wars, I'm a huge fan",
                    notified=True)
    session.add(req14)

    session.commit()
示例#4
0
def setUpModule():

    engine = create_engine(settings)
    populate(engine)

    session = DBSession()
    user_group = Group.by_name(session, u'user')
    manager_group = Group.by_name(session, u'manager')
    sudoer_group = Group.by_name(session, u'sudoer')
    common_password = u'changeme'

    cp_vacation = VacationType.by_name(session, u'CP')
    rtt_vacation = VacationType.by_name(session, u'RTT')
    recovery_vacation = VacationType.by_name(session, u'Récupération')
    sickness_vacation = VacationType.by_name(session, u'Maladie')
    exception_vacation = VacationType.by_name(session, u'Exceptionnel')

    fr_country = Countries.by_name(session, u'fr')
    us_country = Countries.by_name(session, u'us')

    manager1 = User(login=u'manager1',
                    password=common_password,
                    email=u'*****@*****.**',
                    firstname=u'First',
                    lastname=u'Manager',
                    role=u'manager',
                    _country=fr_country,
                    )
    manager1.groups.append(manager_group)
    session.add(manager1)

    manager2 = User(login=u'manager2',
                    password=common_password,
                    email=u'*****@*****.**',
                    firstname=u'Second',
                    lastname=u'Manager',
                    role=u'manager',
                    _country=fr_country,
                    )
    manager2.groups.append(manager_group)
    session.add(manager2)

    manager_us = User(login=u'manager3',
                      password=common_password,
                      email=u'*****@*****.**',
                      firstname=u'Third',
                      lastname=u'Manager',
                      role=u'manager',
                      _country=us_country,
                      )
    manager_us.groups.append(manager_group)
    session.add(manager_us)

    user1 = User(login=u'jdoe',
                 password=common_password,
                 email=u'*****@*****.**',
                 manager=manager1,
                 firstname=u'John',
                 lastname=u'Doe',
                 _country=fr_country,
                 )
    user1.groups.append(user_group)
    session.add(user1)

    user2 = User(login=u'janedoe',
                 password=common_password,
                 email=u'*****@*****.**',
                 manager=manager2,
                 firstname=u'Jane',
                 lastname=u'Doe',
                 _country=fr_country,
                 )
    user2.groups.append(user_group)
    user2.groups.append(sudoer_group)
    session.add(user2)

    session.flush()
    sudoer = Sudoer(source_id=user2.id, target_id=1)
    session.add(sudoer)

    date_from = datetime.strptime('10/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('14/04/2015', '%d/%m/%Y')
    req1 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=cp_vacation,
                   status=u'PENDING',
                   user=user1,
                   notified=False)
    session.add(req1)

    date_from = datetime.strptime('10/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('21/04/2015', '%d/%m/%Y')
    req2 = Request(date_from=date_from,
                   date_to=date_to,
                   days=10,
                   vacation_type=cp_vacation,
                   status=u'PENDING',
                   user=user2,
                   notified=False,)
    session.add(req2)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req3 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=rtt_vacation,
                   status=u'ACCEPTED_MANAGER',
                   user=user1,
                   notified=True,)
    session.add(req3)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req4 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=rtt_vacation,
                   status=u'CANCELED',
                   user=user1,
                   notified=True,)
    session.add(req4)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req5 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=rtt_vacation,
                   status=u'APPROVED_ADMIN',
                   user=manager_us,
                   notified=True,)
    session.add(req5)

    date_from = datetime.strptime('24/08/2011', '%d/%m/%Y')
    date_to = datetime.strptime('24/08/2011', '%d/%m/%Y')
    req6 = Request(date_from=date_from,
                   date_to=date_to,
                   days=0.5,
                   vacation_type=rtt_vacation,
                   status=u'APPROVED_ADMIN',
                   user=user1,
                   notified=True,
                   label=u'AM')
    session.add(req6)

    date_from = datetime.strptime('14/07/2014', '%d/%m/%Y')
    date_to = datetime.strptime('14/07/2014', '%d/%m/%Y')
    req7 = Request(date_from=date_from,
                   date_to=date_to,
                   days=0.5,
                   vacation_type=rtt_vacation,
                   status=u'APPROVED_ADMIN',
                   user=user1,
                   notified=True,
                   label=u'AM')
    session.add(req7)

    # used for rtt vacation checks

    date_from = datetime.strptime('01/04/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/04/2016', '%d/%m/%Y')
    req8 = Request(date_from=date_from,
                   date_to=date_to,
                   days=1,
                   vacation_type=rtt_vacation,
                   status=u'PENDING',
                   user=user1,
                   notified=True)
    session.add(req8)

    date_from = datetime.strptime('01/03/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/03/2016', '%d/%m/%Y')
    req9 = Request(date_from=date_from,
                   date_to=date_to,
                   days=1,
                   vacation_type=rtt_vacation,
                   status=u'ACCEPTED_MANAGER',
                   user=user1,
                   notified=True)
    session.add(req9)

    date_from = datetime.strptime('01/02/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/02/2016', '%d/%m/%Y')
    req10 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=rtt_vacation,
                    status=u'APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req10)

    date_from = datetime.strptime('01/06/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/06/2016', '%d/%m/%Y')
    req11 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=recovery_vacation,
                    status=u'APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req11)

    date_from = datetime.strptime('12/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('12/04/2015', '%d/%m/%Y')
    req12 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=rtt_vacation,
                    status=u'DENIED',
                    user=user1,
                    notified=True)
    session.add(req12)

    date_from = datetime.strptime('06/06/2016', '%d/%m/%Y')
    date_to = datetime.strptime('06/06/2016', '%d/%m/%Y')
    req13 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=sickness_vacation,
                    status=u'APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req13)

    date_from = datetime.strptime('13/06/2016', '%d/%m/%Y')
    date_to = datetime.strptime('13/06/2016', '%d/%m/%Y')
    req14 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=exception_vacation,
                    status=u'APPROVED_ADMIN',
                    user=user2,
                    message=u"I need to see Star Wars, I'm a huge fan",
                    notified=True)
    session.add(req14)

    session.commit()
示例#5
0
文件: __init__.py 项目: baloo/pyvac
def setUpModule():

    engine = create_engine(settings)
    populate(engine)

    session = DBSession()
    user_group = Group.by_name(session, u'user')
    manager_group = Group.by_name(session, u'manager')
    common_password = u'changeme'

    cp_vacation = VacationType.by_name(session, u'CP')
    rtt_vacation = VacationType.by_name(session, u'RTT')

    fr_country = Countries.by_name(session, u'fr')
    us_country = Countries.by_name(session, u'us')

    manager1 = User(login=u'manager1',
                    password=common_password,
                    email=u'*****@*****.**',
                    firstname=u'First',
                    lastname=u'Manager',
                    role=u'manager',
                    _country=fr_country,
                    )
    manager1.groups.append(manager_group)
    session.add(manager1)

    manager2 = User(login=u'manager2',
                    password=common_password,
                    email=u'*****@*****.**',
                    firstname=u'Second',
                    lastname=u'Manager',
                    role=u'manager',
                    _country=fr_country,
                    )
    manager2.groups.append(manager_group)
    session.add(manager2)

    manager_us = User(login=u'manager3',
                      password=common_password,
                      email=u'*****@*****.**',
                      firstname=u'Third',
                      lastname=u'Manager',
                      role=u'manager',
                      _country=us_country,
                      )
    manager_us.groups.append(manager_group)
    session.add(manager_us)

    user1 = User(login=u'jdoe',
                 password=common_password,
                 email=u'*****@*****.**',
                 manager=manager1,
                 firstname=u'John',
                 lastname=u'Doe',
                 _country=fr_country,
                 )
    user1.groups.append(user_group)
    session.add(user1)

    user2 = User(login=u'janedoe',
                 password=common_password,
                 email=u'*****@*****.**',
                 manager=manager2,
                 firstname=u'Jane',
                 lastname=u'Doe',
                 _country=fr_country,
                 )
    user2.groups.append(user_group)
    session.add(user2)

    date_from = datetime.strptime('10/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('14/04/2015', '%d/%m/%Y')
    req1 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=cp_vacation,
                   status=u'PENDING',
                   user=user1,
                   notified=False)
    session.add(req1)

    date_from = datetime.strptime('10/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('21/04/2015', '%d/%m/%Y')
    req2 = Request(date_from=date_from,
                   date_to=date_to,
                   days=10,
                   vacation_type=cp_vacation,
                   status=u'PENDING',
                   user=user2,
                   notified=False,)
    session.add(req2)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req3 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=rtt_vacation,
                   status=u'ACCEPTED_MANAGER',
                   user=user1,
                   notified=True,)
    session.add(req3)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req4 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=rtt_vacation,
                   status=u'CANCELED',
                   user=user1,
                   notified=True,)
    session.add(req4)

    date_from = datetime.strptime('24/04/2015', '%d/%m/%Y')
    date_to = datetime.strptime('28/04/2015', '%d/%m/%Y')
    req5 = Request(date_from=date_from,
                   date_to=date_to,
                   days=5,
                   vacation_type=rtt_vacation,
                   status=u'APPROVED_ADMIN',
                   user=manager_us,
                   notified=True,)
    session.add(req5)

    date_from = datetime.strptime('24/08/2011', '%d/%m/%Y')
    date_to = datetime.strptime('24/08/2011', '%d/%m/%Y')
    req6 = Request(date_from=date_from,
                   date_to=date_to,
                   days=0.5,
                   vacation_type=rtt_vacation,
                   status=u'APPROVED_ADMIN',
                   user=user1,
                   notified=True,
                   label=u'AM')
    session.add(req6)

    date_from = datetime.strptime('14/07/2014', '%d/%m/%Y')
    date_to = datetime.strptime('14/07/2014', '%d/%m/%Y')
    req7 = Request(date_from=date_from,
                   date_to=date_to,
                   days=0.5,
                   vacation_type=rtt_vacation,
                   status=u'APPROVED_ADMIN',
                   user=user1,
                   notified=True,
                   label=u'AM')
    session.add(req7)

    # used for rtt vacation checks

    date_from = datetime.strptime('01/04/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/04/2016', '%d/%m/%Y')
    req8 = Request(date_from=date_from,
                   date_to=date_to,
                   days=1,
                   vacation_type=rtt_vacation,
                   status=u'PENDING',
                   user=user1,
                   notified=True)
    session.add(req8)

    date_from = datetime.strptime('01/03/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/03/2016', '%d/%m/%Y')
    req9 = Request(date_from=date_from,
                   date_to=date_to,
                   days=1,
                   vacation_type=rtt_vacation,
                   status=u'ACCEPTED_MANAGER',
                   user=user1,
                   notified=True)
    session.add(req9)

    date_from = datetime.strptime('01/02/2016', '%d/%m/%Y')
    date_to = datetime.strptime('02/02/2016', '%d/%m/%Y')
    req10 = Request(date_from=date_from,
                    date_to=date_to,
                    days=1,
                    vacation_type=rtt_vacation,
                    status=u'APPROVED_ADMIN',
                    user=user1,
                    notified=True)
    session.add(req10)

    session.commit()