Enlève __unicode__ sur generalizedTimeFormat
This commit is contained in:
parent
9610cc6b0b
commit
c18de85fd2
3 changed files with 15 additions and 6 deletions
|
@ -640,9 +640,6 @@ class generalizedTimeFormat(Attr):
|
|||
__slots__ = ("_stamp", "_datetime",)
|
||||
default = "19700101000000Z"
|
||||
|
||||
def __unicode__(self):
|
||||
return self._datetime.strftime("%d/%m/%Y %H:%M:%S")
|
||||
|
||||
def __float__(self):
|
||||
return self._stamp
|
||||
|
||||
|
|
|
@ -349,6 +349,12 @@ def localized_datetime(date=None, tz=None):
|
|||
"""Builds a datetime object based on a date string formatted as
|
||||
%Y%m%d%H%M%S, and a tz timezone looking like +0200"""
|
||||
|
||||
if tz is None:
|
||||
if "+" in date or '-' in date or 'Z' in date:
|
||||
if date.endswith("Z"):
|
||||
date = date[:-1] + "+0000"
|
||||
date, tz = date[:-5], date[-5:]
|
||||
|
||||
_notz = (tz is None)
|
||||
|
||||
# Shit may happen
|
||||
|
|
|
@ -16,6 +16,7 @@ import gestion.annuaires_pg
|
|||
import gestion.hptools2 as hptools2
|
||||
|
||||
import lc_ldap.attributs as attributs
|
||||
import lc_ldap.crans_utils as crans_utils
|
||||
|
||||
def try_import(lib):
|
||||
"""
|
||||
|
@ -201,16 +202,21 @@ def list_factures(factures, width=None):
|
|||
data = []
|
||||
for facture in factures:
|
||||
controle = facture.get('controle', [""])[0]
|
||||
if controle == "TRUE":
|
||||
if controle == u"TRUE":
|
||||
controle = style(u"Validée", "vert")
|
||||
elif controle == "FALSE":
|
||||
elif controle == u"FALSE":
|
||||
controle = style(u"Invalide", "rouge")
|
||||
else:
|
||||
controle = u"N/A"
|
||||
if facture.get('recuPaiement', []):
|
||||
_dtime = crans_utils.datetime_from_generalized_time_format(unicode(facture.get('recuPaiement', [attributs.recuPaiement.default])[0]))
|
||||
_recu = _dtime.strftime("%d/%m/%Y %H:%M:%S")
|
||||
else:
|
||||
_recu = False
|
||||
data.append([
|
||||
facture['fid'][0],
|
||||
facture['modePaiement'][0],
|
||||
style(facture.get('recuPaiement', [])[0], "vert") if facture.get('recuPaiement', []) else style("NON", "rouge"),
|
||||
style(_recu, 'vert') if _recu else style(u"NON", 'rouge'),
|
||||
controle,
|
||||
' '.join(attr['code'] for attr in facture.get('article',[])),
|
||||
u"%s €" % sum([float(a['pu'])*int(a['nombre']) for a in facture.get('article',[])])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue