forked from ScoDoc/DocScoDoc
Fix desinscription
This commit is contained in:
parent
fcc28839c0
commit
c3d6c1f40f
@ -163,7 +163,12 @@ def do_formsemestre_desinscription(etudid, formsemestre_id, REQUEST=None):
|
|||||||
cnx = ndb.GetDBConnexion()
|
cnx = ndb.GetDBConnexion()
|
||||||
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"select moduleimpl_inscription_id from notes_moduleimpl_inscription Im, notes_moduleimpl M where Im.etudid=%(etudid)s and Im.moduleimpl_id = M.moduleimpl_id and M.formsemestre_id = %(formsemestre_id)s",
|
"""SELECT Im.id AS moduleimpl_inscription_id
|
||||||
|
FROM notes_moduleimpl_inscription Im, notes_moduleimpl M
|
||||||
|
WHERE Im.etudid=%(etudid)s
|
||||||
|
and Im.moduleimpl_id = M.id
|
||||||
|
and M.formsemestre_id = %(formsemestre_id)s
|
||||||
|
""",
|
||||||
{"etudid": etudid, "formsemestre_id": formsemestre_id},
|
{"etudid": etudid, "formsemestre_id": formsemestre_id},
|
||||||
)
|
)
|
||||||
res = cursor.fetchall()
|
res = cursor.fetchall()
|
||||||
|
@ -371,19 +371,40 @@ class PDFLock(object):
|
|||||||
log("PDFLock: granted to %s" % self.current_thread)
|
log("PDFLock: granted to %s" % self.current_thread)
|
||||||
|
|
||||||
|
|
||||||
|
class WatchLock:
|
||||||
|
"Surveille threads (mais ne verrouille pas)"
|
||||||
|
|
||||||
|
def __init__(self, timeout=None):
|
||||||
|
self.timeout = timeout
|
||||||
|
t = threading.current_thread()
|
||||||
|
self.native_id = t.native_id
|
||||||
|
self.ident = t.ident
|
||||||
|
|
||||||
|
def acquire(self):
|
||||||
|
t = threading.current_thread()
|
||||||
|
if (self.native_id != t.native_id) or (self.ident != t.ident):
|
||||||
|
log(
|
||||||
|
f"Warning: LOCK detected several threads ! (native_id {self.native_id} -> {t.native_id}, ident {self.ident} -> {t.ident}"
|
||||||
|
)
|
||||||
|
self.native_id = t.native_id
|
||||||
|
self.ident = t.ident
|
||||||
|
|
||||||
|
def release(self):
|
||||||
|
t = threading.current_thread()
|
||||||
|
assert (self.native_id == t.native_id) and (self.ident == t.ident)
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FakeLock:
|
class FakeLock:
|
||||||
"Pour ScoDoc 9: pas de verrou"
|
"Pour ScoDoc 9: pas de verrou"
|
||||||
|
|
||||||
def __init__(self, timeout=15):
|
def __init__(self, timeout=None):
|
||||||
self.timeout = timeout
|
pass
|
||||||
self.current_thread = threading.get_ident()
|
|
||||||
|
|
||||||
def acquire(self):
|
def acquire(self):
|
||||||
assert threading.get_ident() == self.current_thread
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def release(self):
|
def release(self):
|
||||||
assert threading.get_ident() == self.current_thread
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -1289,7 +1289,7 @@ def do_formsemestre_inscription_listinscrits(
|
|||||||
return scu.sendResult(REQUEST, r, format=format, name="inscrits")
|
return scu.sendResult(REQUEST, r, format=format, name="inscrits")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/formsemestre_desinscription")
|
@bp.route("/formsemestre_desinscription", methods=["GET", "POST"])
|
||||||
@scodoc
|
@scodoc
|
||||||
@permission_required(Permission.ScoImplement)
|
@permission_required(Permission.ScoImplement)
|
||||||
@scodoc7func
|
@scodoc7func
|
||||||
@ -1373,6 +1373,7 @@ sco_publish(
|
|||||||
"/do_formsemestre_desinscription",
|
"/do_formsemestre_desinscription",
|
||||||
sco_formsemestre_inscriptions.do_formsemestre_desinscription,
|
sco_formsemestre_inscriptions.do_formsemestre_desinscription,
|
||||||
Permission.ScoEtudInscrit,
|
Permission.ScoEtudInscrit,
|
||||||
|
methods=["GET", "POST"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user