Projet

Général

Profil

0002-evalutils-add-attachment-content-filename-content_ty.patch

Benjamin Dauvergne, 22 octobre 2018 12:05

Télécharger (1,07 ko)

Voir les différences:

Subject: [PATCH 2/3] evalutils: add attachment(content, filename,
 content_type) helper (#27323)

 wcs/qommon/evalutils.py | 13 +++++++++++++
 1 file changed, 13 insertions(+)
wcs/qommon/evalutils.py
118 118
    today = make_datetime(today)
119 119
    return datetime_delta(today, born).total_seconds()
120 120

  
121

  
121 122
def add_days(date, count):
122 123
    '''Add the given number of days to date'''
123 124
    return make_date(date) + datetime.timedelta(days=count)
125

  
126

  
127
def attachment(content, filename='', content_type='application/octet-stream'):
128
    '''Serialize content as an attachment'''
129
    import base64
130

  
131
    return {
132
        'filename': filename,
133
        'content_type': content_type,
134
        'b64_content': base64.b64encode(content),
135
    }
136

  
124
-