forked from ScoDoc/ScoDoc
code cleaning
This commit is contained in:
parent
30481e4729
commit
c8949e870f
@ -245,7 +245,7 @@ class BaseArchiver(object):
|
||||
log("reading archive file %s" % fname)
|
||||
return open(fname, "rb").read()
|
||||
|
||||
def get_archived_file(self, REQUEST, oid, archive_name, filename):
|
||||
def get_archived_file(self, oid, archive_name, filename):
|
||||
"""Recupere donnees du fichier indiqué et envoie au client"""
|
||||
archive_id = self.get_id_from_name(oid, archive_name)
|
||||
data = self.get(archive_id, filename)
|
||||
@ -544,11 +544,11 @@ def formsemestre_list_archives(REQUEST, formsemestre_id):
|
||||
return "\n".join(H) + html_sco_header.sco_footer()
|
||||
|
||||
|
||||
def formsemestre_get_archived_file(REQUEST, formsemestre_id, archive_name, filename):
|
||||
def formsemestre_get_archived_file(formsemestre_id, archive_name, filename):
|
||||
"""Send file to client."""
|
||||
sem = sco_formsemestre.get_formsemestre(formsemestre_id)
|
||||
sem_archive_id = sem["scodoc7_id"] or formsemestre_id
|
||||
return PVArchive.get_archived_file(REQUEST, sem_archive_id, archive_name, filename)
|
||||
return PVArchive.get_archived_file(sem_archive_id, archive_name, filename)
|
||||
|
||||
|
||||
def formsemestre_delete_archive(
|
||||
|
@ -242,16 +242,14 @@ def etud_delete_archive(REQUEST, etudid, archive_name, dialog_confirmed=False):
|
||||
)
|
||||
|
||||
|
||||
def etud_get_archived_file(REQUEST, etudid, archive_name, filename):
|
||||
def etud_get_archived_file(etudid, archive_name, filename):
|
||||
"""Send file to client."""
|
||||
etuds = sco_etud.get_etud_info(filled=True)
|
||||
etuds = sco_etud.get_etud_info(etudid=etudid, filled=True)
|
||||
if not etuds:
|
||||
raise ScoValueError("étudiant inexistant")
|
||||
etud = etuds[0]
|
||||
etud_archive_id = etud["scodoc7_id"] or etud["etudid"]
|
||||
return EtudsArchive.get_archived_file(
|
||||
REQUEST, etud_archive_id, archive_name, filename
|
||||
)
|
||||
return EtudsArchive.get_archived_file(etud_archive_id, archive_name, filename)
|
||||
|
||||
|
||||
# --- Upload d'un ensemble de fichiers (pour un groupe d'étudiants)
|
||||
|
@ -35,9 +35,8 @@ from email.mime.multipart import MIMEMultipart
|
||||
from email.mime.text import MIMEText
|
||||
from email.mime.base import MIMEBase
|
||||
from email.header import Header
|
||||
|
||||
from reportlab.lib.colors import Color
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
import urllib
|
||||
|
||||
from flask import g
|
||||
from flask import url_for
|
||||
@ -1064,7 +1063,7 @@ def _formsemestre_bulletinetud_header_html(
|
||||
# Menu
|
||||
endpoint = "notes.formsemestre_bulletinetud"
|
||||
url = REQUEST.URL0
|
||||
qurl = six.moves.urllib.parse.quote_plus(url + "?" + REQUEST.QUERY_STRING)
|
||||
qurl = urllib.parse.quote_plus(url + "?" + REQUEST.QUERY_STRING)
|
||||
|
||||
menuBul = [
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ import datetime
|
||||
import operator
|
||||
import pprint
|
||||
import time
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
import urllib
|
||||
|
||||
import flask
|
||||
from flask import url_for
|
||||
@ -1089,7 +1089,7 @@ def evaluation_describe(evaluation_id="", edit_in_place=True):
|
||||
% (
|
||||
scu.ScoURL(),
|
||||
group_id,
|
||||
six.moves.urllib.parse.quote(E["jour"], safe=""),
|
||||
urllib.parse.quote(E["jour"], safe=""),
|
||||
)
|
||||
)
|
||||
H.append(
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
"""Liste des notes d'une évaluation
|
||||
"""
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
from operator import itemgetter
|
||||
import urllib
|
||||
|
||||
import flask
|
||||
from flask import url_for, g
|
||||
@ -817,8 +817,8 @@ def evaluation_check_absences_html(
|
||||
'<a class="stdlink" href="Absences/doSignaleAbsence?etudid=%s&datedebut=%s&datefin=%s&demijournee=%s&moduleimpl_id=%s">signaler cette absence</a>'
|
||||
% (
|
||||
etud["etudid"],
|
||||
six.moves.urllib.parse.quote(E["jour"]),
|
||||
six.moves.urllib.parse.quote(E["jour"]),
|
||||
urllib.parse.quote(E["jour"]),
|
||||
urllib.parse.quote(E["jour"]),
|
||||
demijournee,
|
||||
E["moduleimpl_id"],
|
||||
)
|
||||
|
@ -28,7 +28,7 @@
|
||||
"""Tableau de bord module
|
||||
"""
|
||||
import time
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
import urllib
|
||||
|
||||
from flask import g, url_for
|
||||
from flask_login import current_user
|
||||
@ -137,7 +137,7 @@ def moduleimpl_evaluation_menu(evaluation_id, nbnotes=0, REQUEST=None):
|
||||
"title": "Absences ce jour",
|
||||
"endpoint": "absences.EtatAbsencesDate",
|
||||
"args": {
|
||||
"date": six.moves.urllib.parse.quote(E["jour"], safe=""),
|
||||
"date": urllib.parse.quote(E["jour"], safe=""),
|
||||
"group_ids": group_id,
|
||||
},
|
||||
"enabled": E["jour"],
|
||||
|
@ -30,9 +30,9 @@
|
||||
Contribution M. Salomon, UFC / IUT DE BELFORT-MONTBÉLIARD, 2016
|
||||
|
||||
"""
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
import random
|
||||
import time
|
||||
import urllib
|
||||
|
||||
import flask
|
||||
|
||||
@ -208,10 +208,7 @@ def do_placement_selectetuds(REQUEST):
|
||||
columns = tf[2]["columns"]
|
||||
numbering = tf[2]["numbering"]
|
||||
if columns in ("3", "4", "5", "6", "7", "8"):
|
||||
gs = [
|
||||
("group_ids%3Alist=" + six.moves.urllib.parse.quote_plus(x))
|
||||
for x in group_ids
|
||||
]
|
||||
gs = [("group_ids%3Alist=" + urllib.parse.quote_plus(x)) for x in group_ids]
|
||||
query = (
|
||||
"evaluation_id=%s&placement_method=%s&teachers=%s&building=%s&room=%s&columns=%s&numbering=%s&"
|
||||
% (
|
||||
|
@ -590,18 +590,17 @@ def _notes_add(user, evaluation_id: int, notes: list, comment=None, do_it=True):
|
||||
|
||||
def saisie_notes_tableur(evaluation_id, group_ids=[], REQUEST=None):
|
||||
"""Saisie des notes via un fichier Excel"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
authusername = str(authuser)
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
raise ScoValueError("invalid evaluation_id")
|
||||
E = evals[0]
|
||||
M = sco_moduleimpl.do_moduleimpl_list(moduleimpl_id=E["moduleimpl_id"])[0]
|
||||
formsemestre_id = M["formsemestre_id"]
|
||||
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||
if not sco_permissions_check.can_edit_notes(current_user, E["moduleimpl_id"]):
|
||||
return (
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
||||
+ "<h2>Modification des notes impossible pour %s</h2>"
|
||||
% current_user.user_name
|
||||
+ """<p>(vérifiez que le semestre n'est pas verrouillé et que vous
|
||||
avez l'autorisation d'effectuer cette opération)</p>
|
||||
<p><a href="moduleimpl_status?moduleimpl_id=%s">Continuer</a></p>
|
||||
@ -859,8 +858,6 @@ def has_existing_decision(M, E, etudid):
|
||||
|
||||
def saisie_notes(evaluation_id, group_ids=[], REQUEST=None):
|
||||
"""Formulaire saisie notes d'une évaluation pour un groupe"""
|
||||
authuser = REQUEST.AUTHENTICATED_USER
|
||||
authusername = str(authuser)
|
||||
group_ids = [int(group_id) for group_id in group_ids]
|
||||
evals = sco_evaluations.do_evaluation_list({"evaluation_id": evaluation_id})
|
||||
if not evals:
|
||||
@ -872,10 +869,11 @@ def saisie_notes(evaluation_id, group_ids=[], REQUEST=None):
|
||||
formsemestre_id = M["formsemestre_id"]
|
||||
# Check access
|
||||
# (admin, respformation, and responsable_id)
|
||||
if not sco_permissions_check.can_edit_notes(authuser, E["moduleimpl_id"]):
|
||||
if not sco_permissions_check.can_edit_notes(current_user, E["moduleimpl_id"]):
|
||||
return (
|
||||
html_sco_header.sco_header()
|
||||
+ "<h2>Modification des notes impossible pour %s</h2>" % authusername
|
||||
+ "<h2>Modification des notes impossible pour %s</h2>"
|
||||
% current_user.user_name
|
||||
+ """<p>(vérifiez que le semestre n'est pas verrouillé et que vous
|
||||
avez l'autorisation d'effectuer cette opération)</p>
|
||||
<p><a href="moduleimpl_status?moduleimpl_id=%s">Continuer</a></p>
|
||||
|
@ -47,20 +47,17 @@ L'API de plus bas niveau est en gros:
|
||||
"""
|
||||
|
||||
import calendar
|
||||
import cgi
|
||||
import datetime
|
||||
import dateutil
|
||||
import dateutil.parser
|
||||
import re
|
||||
import six.moves.urllib.request, six.moves.urllib.parse, six.moves.urllib.error
|
||||
import string
|
||||
import time
|
||||
import urllib
|
||||
from xml.etree import ElementTree
|
||||
|
||||
import flask
|
||||
from flask import g
|
||||
from flask import url_for
|
||||
from flask import current_app
|
||||
|
||||
from app.decorators import (
|
||||
scodoc,
|
||||
@ -307,14 +304,14 @@ def doSignaleAbsenceGrSemestre(
|
||||
@permission_required(Permission.ScoAbsChange)
|
||||
@scodoc7func
|
||||
def SignaleAbsenceGrHebdo(
|
||||
datelundi, group_ids=[], destination="", moduleimpl_id=None, REQUEST=None
|
||||
datelundi, group_ids=[], destination="", moduleimpl_id=None, formsemestre_id=None
|
||||
):
|
||||
"Saisie hebdomadaire des absences"
|
||||
if not moduleimpl_id:
|
||||
moduleimpl_id = None
|
||||
|
||||
groups_infos = sco_groups_view.DisplayedGroupsInfos(
|
||||
group_ids, moduleimpl_id=moduleimpl_id
|
||||
group_ids, moduleimpl_id=moduleimpl_id, formsemestre_id=formsemestre_id
|
||||
)
|
||||
if not groups_infos.members:
|
||||
return (
|
||||
@ -326,7 +323,7 @@ def SignaleAbsenceGrHebdo(
|
||||
base_url = "SignaleAbsenceGrHebdo?datelundi=%s&%s&destination=%s" % (
|
||||
datelundi,
|
||||
groups_infos.groups_query_args,
|
||||
six.moves.urllib.parse.quote(destination),
|
||||
urllib.parse.quote(destination),
|
||||
)
|
||||
|
||||
formsemestre_id = groups_infos.formsemestre_id
|
||||
@ -510,7 +507,7 @@ def SignaleAbsenceGrSemestre(
|
||||
datedebut,
|
||||
datefin,
|
||||
groups_infos.groups_query_args,
|
||||
six.moves.urllib.parse.quote(destination),
|
||||
urllib.parse.quote(destination),
|
||||
)
|
||||
)
|
||||
base_url = base_url_noweeks + "&nbweeks=%s" % nbweeks # sans le moduleimpl_id
|
||||
@ -810,7 +807,7 @@ def _gen_form_saisie_groupe(
|
||||
H.append('<input type="hidden" name="dates" value="%s"/>' % ",".join(dates))
|
||||
H.append(
|
||||
'<input type="hidden" name="destination" value="%s"/>'
|
||||
% six.moves.urllib.parse.quote(destination)
|
||||
% urllib.parse.quote(destination)
|
||||
)
|
||||
#
|
||||
# version pour formulaire avec AJAX (Yann LB)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
SCOVERSION = "9.0.26"
|
||||
SCOVERSION = "9.0.27"
|
||||
|
||||
SCONAME = "ScoDoc"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user