From 58761db787a3f29cdd83c391711ee8dc267414a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Elliott=20B=C3=A9cue?= Date: Mon, 13 Apr 2015 02:41:31 +0200 Subject: [PATCH] Bugfix de l'affichage de derniereConnexion * timeformat ne connaissait pas les attributs lc_ldap * et il lui faut deux arguments --- printing/templates/compte_crans | 4 ++-- printing/templates/templates.py | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/printing/templates/compte_crans b/printing/templates/compte_crans index 6af9ca0..9272113 100644 --- a/printing/templates/compte_crans +++ b/printing/templates/compte_crans @@ -3,8 +3,8 @@ {% if o.droits %} {{"Droits sur les serveurs : "|coul('gras')}}{{o.droits|join(', ')}} {% endif %} -{{"Dernière connexion : "|coul('gras')}}{%if derniereConnexion %} -{{o.derniereConnexion.0|timeformat}} +{{"Dernière connexion : "|coul('gras')}}{%if o.derniereConnexion %} +{{o.derniereConnexion.0|timeformat('%d/%m/%Y %H:%M:%S')}} {% else %} {{"Jamais"|coul('rouge')}} {% endif %} diff --git a/printing/templates/templates.py b/printing/templates/templates.py index 8429ae7..2589717 100644 --- a/printing/templates/templates.py +++ b/printing/templates/templates.py @@ -13,6 +13,8 @@ import gestion.config as config import gestion import gestion.annuaires_pg +import lc_ldap.attributs as attributs + def try_import(lib): """ Cette fonction sert à faire de l'import soft : si l'import @@ -43,6 +45,8 @@ def prise_etat(chbre): return gestion.whos.prise_etat(chbre)[0] def timeformat(t, format): + if isinstance(t, attributs.Attr): + t = float(t.value) return time.strftime(format, time.localtime(t)) def blacklists(l):