ajout batch_nuit

This commit is contained in:
2020-12-13 09:19:49 +01:00
parent ef9e56a272
commit 154264fbad
6 changed files with 45 additions and 14 deletions

View File

@@ -340,7 +340,8 @@ def devis_preview(request):
elif ligne.ref == 'TX':
dt_html += '<tr><td colspan="3"><p>%s</p></td></tr>' % ligne.libelle
elif ligne.type_ligne == 'AR':
dt_html += '<tr><td><p>%s<br />' % ligne.libelle
dt_html += '<tr><td style="vertical-align: top">%s</td>' % ligne.ref
dt_html += '<td><p>%s<br />' % ligne.libelle
if ligne.metrage:
dt_html += ligne.metrage
if ligne.deduction:

21
mondumas/views/utils.py Normal file
View File

@@ -0,0 +1,21 @@
# -*- coding: utf8 -*-
from pyramid.response import Response
from pyramid.view import (
view_config,
)
@view_config(route_name='batch_nuit')
def batch_nuit(request):
"""
Traitement de nuit lancé chaque nuit à heure fixe par cron
Par sécurité, ce view ne peut être appelé qu'avec un paramètre secret 'JonSn0w'
"""
# import pdb;pdb.set_trace()
# contrôle : paramètre correct ? non, terminer
par = request.matchdict['param']
if par != 'JonSn0w':
return Response('Erreur : paramètre incorrect')
return Response('Batch nuit terminé OK')