do_formsemestre_inscription_listinscrits: json, xml, ...

This commit is contained in:
IDK 2021-04-30 11:04:02 +02:00
parent bfc3557814
commit d2aac186eb
2 changed files with 15 additions and 16 deletions

View File

@ -191,15 +191,13 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
# Affecte aussi cache inscriptions
self.get_formsemestre_inscription_cache().inval_cache(
key=formsemestre_id
) # >
)
else:
self._getNotesCache().inval_cache(
self, formsemestre_id=formsemestre_id, pdfonly=pdfonly
) # >
)
# Affecte aussi cache inscriptions
self.get_formsemestre_inscription_cache().inval_cache(
key=formsemestre_id
) # >
self.get_formsemestre_inscription_cache().inval_cache(key=formsemestre_id)
security.declareProtected(ScoView, "clearcache")
@ -1807,18 +1805,19 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
security.declareProtected(ScoView, "do_formsemestre_inscription_listinscrits")
def do_formsemestre_inscription_listinscrits(self, formsemestre_id):
def do_formsemestre_inscription_listinscrits(
self, formsemestre_id, format=None, REQUEST=None
):
"""Liste les inscrits (état I) à ce semestre et cache le résultat"""
cache = self.get_formsemestre_inscription_cache()
r = cache.get(formsemestre_id)
if r != None:
return r
# retreive list
r = self.do_formsemestre_inscription_list(
args={"formsemestre_id": formsemestre_id, "etat": "I"}
)
cache.set(formsemestre_id, r)
return r
if r is None:
# retreive list
r = self.do_formsemestre_inscription_list(
args={"formsemestre_id": formsemestre_id, "etat": "I"}
)
cache.set(formsemestre_id, r)
return scu.sendResult(REQUEST, r, format=format, name="inscrits")
security.declareProtected(ScoImplement, "do_formsemestre_inscription_edit")
@ -1831,7 +1830,7 @@ class ZNotes(ObjectManager, PropertyManager, RoleManager, Item, Persistent, Impl
) # > modif inscription semestre (demission ?)
# Cache inscriptions semestres
def get_formsemestre_inscription_cache(self):
def get_formsemestre_inscription_cache(self, format=None):
u = self.GetDBConnexionString()
if CACHE_formsemestre_inscription.has_key(u):
return CACHE_formsemestre_inscription[u]

View File

@ -582,7 +582,7 @@ def sendXML(REQUEST, data, tagname=None, force_outer_xml_tag=True):
def sendResult(REQUEST, data, name=None, format=None, force_outer_xml_tag=True):
if format is None:
if (format is None) or (format == "html"):
return data
elif format == "xml": # name is outer tagname
return sendXML(