From d0e179fb7cb3e8b8d0366b5808c1658ed7c19ba3 Mon Sep 17 00:00:00 2001 From: leonard_montalbano Date: Thu, 9 Jun 2022 15:48:24 +0200 Subject: [PATCH] reset du fichier debug.py --- app/api/debug.py | 76 ++++++++++++++++++------------------------------ 1 file changed, 29 insertions(+), 47 deletions(-) diff --git a/app/api/debug.py b/app/api/debug.py index ba6094070..c2ed2eb53 100644 --- a/app/api/debug.py +++ b/app/api/debug.py @@ -1,49 +1,31 @@ -from app.api import bp -from app.api.auth import token_auth, token_permission_required -from app.models import NotesNotes, FormSemestre -from app.scodoc.sco_permissions import Permission -from flask import jsonify -from app import models -from app import db -import time -import random -import datetime +# -*- mode: python -*- +# -*- coding: utf-8 -*- +############################################################################## +# +# Gestion scolarite IUT +# +# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# Emmanuel Viennet emmanuel.viennet@viennet.net +# +############################################################################## -@bp.route("/create_note", methods=["GET"]) -@token_auth.login_required -@token_permission_required(Permission.APIView) -def create_note(): - note = NotesNotes() - db.session.add(note) - db.session.commit() - - return jsonify(note.to_dict()) - - -@bp.route("/change_value_note/", methods=["GET"]) -@token_auth.login_required -@token_permission_required(Permission.APIView) -def change_value_note(note_id: int): - note = NotesNotes.query.get_or_404(note_id) - note.value = 10 - db.session.commit() - - return jsonify(note.to_dict()) - - -@bp.route( - "/change_date_note/", methods=["GET"] -) # XXX TODO test avec notes_add() en plus -@token_auth.login_required -@token_permission_required(Permission.APIView) -def change_date_note(note_id: int): - - formsemestre = FormSemestre.query.get_or_404(1) - date_debut = formsemestre.date_debut - date_fin = formsemestre.date_fin - note = NotesNotes.query.get_or_404(note_id) - note.date = date_debut + random.random() * (date_fin - date_debut) - db.session.commit() - - return jsonify(note.to_dict()) +""" +!!! ATTENTION !!! +Fichier a utilisé uniquement à des fins de debug +"""