Esempio n. 1
0
def competence_index_view(request):
    """
    Index view to go to a competence grid
    """
    competence_js.need()
    user_options = get_users_options(roles=['contractor'])
    deadlines = CompetenceDeadline.query().all()
    if 'deadline' in request.POST or 'sheet' in request.POST:
        logger.debug(request.POST)
        schema = CompetenceGridQuerySchema.bind(request=request)
        try:
            appstruct = schema.deserialize(request.POST)
        except colander.Invalid:
            logger.exception(u"Erreur dans le routage de la page de \
compétences : POSSIBLE BREAK IN ATTEMPT")
        else:
            # On récupère l'id du user pour l'évaluation
            contractor_id = appstruct['contractor_id']
            # L'id de la période d'évaluation
            deadline_id = appstruct['deadline']

            # On redirige vers la page appropriée
            grid = get_competence_grid(
                request,
                contractor_id,
                deadline_id
            )
            url = request.route_path("competence_grid", id=grid.id)
            return HTTPFound(url)

    return {
        'title': u'Évaluation des compétences',
        'user_options': user_options,
        'deadlines': deadlines,
    }
Esempio n. 2
0
def competence_index_view(request):
    """
    Index view to go to a competence grid
    """
    competence_js.need()
    user_options = get_users_options(roles=['contractor'])
    deadlines = CompetenceDeadline.query().all()
    if 'deadline' in request.POST or 'sheet' in request.POST:
        logger.debug(request.POST)
        schema = CompetenceGridQuerySchema.bind(request=request)
        try:
            appstruct = schema.deserialize(request.POST)
        except colander.Invalid:
            logger.exception(u"Erreur dans le routage de la page de \
compétences : POSSIBLE BREAK IN ATTEMPT")
        else:
            # On récupère l'id du user pour l'évaluation
            contractor_id = appstruct['contractor_id']
            # L'id de la période d'évaluation
            deadline_id = appstruct['deadline']

            # On redirige vers la page appropriée
            grid = get_competence_grid(
                request,
                contractor_id,
                deadline_id
            )
            url = request.route_path("competence_grid", id=grid.id)
            return HTTPFound(url)

    return {
        'title': u'Évaluation des compétences',
        'user_options': user_options,
        'deadlines': deadlines,
    }
Esempio n. 3
0
def validate_competence_grid_query(request):
    """
    Validate datas posted to access a competence grid

    :param obj request: The pyramid request
    """
    schema = CompetenceGridQuerySchema.bind(request=request)
    try:
        appstruct = schema.deserialize(request.POST)
    except colander.Invalid:
        logger.exception(u"Erreur dans le routage de la page de \
compétences : POSSIBLE BREAK IN ATTEMPT")
    else:
        return appstruct
    return None
Esempio n. 4
0
def validate_competence_grid_query(request):
    """
    Validate datas posted to access a competence grid

    :param obj request: The pyramid request
    """
    schema = CompetenceGridQuerySchema.bind(request=request)
    try:
        appstruct = schema.deserialize(request.POST)
    except colander.Invalid:
            logger.exception(u"Erreur dans le routage de la page de \
compétences : POSSIBLE BREAK IN ATTEMPT")
    else:
        return appstruct
    return None