dev/passerelle: abonnements-from-request.patch (#6577)

This commit is contained in:
Thomas NOËL 2015-03-19 11:41:43 +01:00
parent 4e84ff106c
commit 29a89986ba
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,28 @@
--- passerelle-ef79c2a/passerelle/apps/bdp/views.py.orig 2015-03-19 11:16:32.966003088 +0100
+++ passerelle-ef79c2a/passerelle/apps/bdp/views.py 2015-03-19 11:23:26.232711866 +0100
@@ -16,6 +16,7 @@
# See documentation:
# https://dev.entrouvert.org/projects/bdp/wiki/WebServices
+DEFAULT_ABONNEMENTS = '15'
class ResourcesView(View, SingleObjectMixin):
model = Bdp
@@ -50,6 +51,8 @@
date_de_naissance = data['fields'].get('date_de_naissance')
# force 1973-04-18T00:00:00Z
date_de_naissance = date_de_naissance[:10] + 'T00:00:00Z'
+ abonnements = data['fields'].get('abonnements_raw') or \
+ request.GET.get('abonnements') or DEFAULT_ABONNEMENTS
adherent = {
'nom': data['fields'].get('nom'),
'prenom': data['fields'].get('prenom'),
@@ -58,7 +61,7 @@
'dateNaissance': date_de_naissance,
'actif': 'on',
'bibliotheque': {'id': data['fields'].get('bibliotheque_raw')},
- 'abonnements': '15',
+ 'abonnements': abonnements,
}
return self.get_object().post_api('adherents', adherent)

View File

@ -28,6 +28,7 @@ Source5: synchro-cron.sh
Source6: wcs-au-quotidien.cron.d
Source7: passerelle-manage
Source8: cg14_config.py
Patch1: abonnements-from-request.patch
BuildArch: noarch
@ -39,6 +40,7 @@ Passerelle provides an uniform access to multiple data sources and services.
%prep
%setup -q -n passerelle-%{commit}
%patch1 -p1
%pre
getent group passerelle >/dev/null || groupadd -r passerelle