cartads: don't include None descriptions in labels (#32745)
This commit is contained in:
parent
b312381a75
commit
e1f8bf238c
|
@ -169,9 +169,16 @@ class AbstractCartaDSCS(BaseResource):
|
|||
client = self.soap_client()
|
||||
resp = client.service.GetListePdf(self.get_token(), type_dossier_id,
|
||||
{'TypeCompteUtilisateur': type_compte})
|
||||
def format_cerfa_label(x):
|
||||
try:
|
||||
if x['Description']:
|
||||
return u'%(Nom)s: %(Description)s' % x
|
||||
except KeyError:
|
||||
pass
|
||||
return u'%(Nom)s' % x
|
||||
return {'data': [
|
||||
{'id': x['Identifiant'],
|
||||
'text': u'%s: %s' % (x['Nom'], x['Description']),
|
||||
'text': format_cerfa_label(x),
|
||||
'url': x['UrlTelechargement'],
|
||||
} for x in resp or []]}
|
||||
|
||||
|
|
Loading…
Reference in New Issue