Commit ca21d916 authored by LE GAC Renaud's avatar LE GAC Renaud
Browse files

More robust callback algorithms

parent e93f61a9
......@@ -142,13 +142,14 @@ def INHIBIT_PUBLICATION_DELETE_ON_OK(s):
# in normal case the query is "publications.id = 567"
# in cascade delete the query is "publications.id_teams IN (21)"
if s.query.first is db.publications.id:
if s.query.first is not db.publications.id:
return False
id = s.query.second
if db.publications[id].id_status == id_ok:
db.publications[CALLBACK_ERRORS] = \
T("Can't delete a publication marked OK.")
return True
id = s.query.second
if db.publications[id].id_status == id_ok:
db.publications[CALLBACK_ERRORS] = \
T("Can't delete a publication marked OK.")
return True
return False
......@@ -169,7 +170,12 @@ def INHIBIT_PUBLICATION_UPDATE_ON_OK(s, f):
db, T = current.globalenv['db'], current.T
id_ok = get_id(db.status, code='OK')
id = f["id"]
# protection
# the query of the set should be "publications.id == 45"
if s.query.first is not db.publications.id:
return False
id = set.query.second
if db.publications[id].id_status == id_ok:
db.publications[CALLBACK_ERRORS] = \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment