Projet

Général

Profil

0001-agora-allow-wcs-to-send-dates-formatted-as-Y-m-d-114.patch

Frédéric Péters, 20 juin 2016 14:36

Télécharger (1,1 ko)

Voir les différences:

Subject: [PATCH] agora+: allow wcs to send dates formatted as %Y-%m-%d
 (#11436)

 passerelle/contrib/agoraplus/wcs.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
passerelle/contrib/agoraplus/wcs.py
19 19
import datetime
20 20

  
21 21
def date_from_iso(s):
22
    utc = time.strptime(s, '%Y-%m-%dT%H:%M:%SZ')
23
    timestamp = calendar.timegm(utc)
24
    return datetime.date.fromtimestamp(timestamp).strftime('%Y-%m-%d')
22
    if 'T' in s:
23
        utc = time.strptime(s, '%Y-%m-%dT%H:%M:%SZ')
24
        timestamp = calendar.timegm(utc)
25
        return datetime.date.fromtimestamp(timestamp).strftime('%Y-%m-%d')
26
    else:
27
        return datetime.datetime.strptime(s, '%Y-%m-%d').date()
25 28

  
26 29
def booleanize(value):
27 30
    '''
28
-