+ class TypeChoices(object):
+
+ def __iter__(self):
+ """Génère dynamiquement les choix possibles pour la recherche par type."""
+ yield ('', '')
+ cursor = db.connection.cursor()
+ cursor.execute("SELECT DISTINCT REPLACE(REPLACE(type, ', PeerReviewed', ''), ', NonPeerReviewed', '') FROM savoirs_record")
+ for result in cursor.fetchall():
+ type = result[0].strip()
+ if type:
+ yield (type, type)
+
+ TYPE_CHOICES = TypeChoices()
+