prod/passerelle: add-parameters-to-post-adherent

This commit is contained in:
Thomas NOËL 2015-03-24 10:05:42 +01:00
parent e11eadf12f
commit efaa9e0996
2 changed files with 42 additions and 0 deletions

View File

@ -0,0 +1,40 @@
From db6a038ab98f828fa3c478c41449068a328f1e9d Mon Sep 17 00:00:00 2001
From: Thomas NOEL <tnoel@entrouvert.com>
Date: Thu, 19 Mar 2015 13:29:37 +0100
Subject: [PATCH] bdp: add parameters to post/adherent (#6577)
---
passerelle/apps/bdp/views.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/passerelle/apps/bdp/views.py b/passerelle/apps/bdp/views.py
index ddced57..4f13826 100644
--- a/passerelle/apps/bdp/views.py
+++ b/passerelle/apps/bdp/views.py
@@ -50,6 +50,12 @@ class PostAdherentView(View, SingleObjectMixin):
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 \
+ data['fields'].get('abonnements_raw') or \
+ request.GET.get('abonnements')
+ bibliotheque_id = data['fields'].get('bibliotheque_raw') or \
+ data['fields'].get('bibliotheque') or \
+ request.GET.get('bibliotheque')
adherent = {
'nom': data['fields'].get('nom'),
'prenom': data['fields'].get('prenom'),
@@ -57,8 +63,8 @@ class PostAdherentView(View, SingleObjectMixin):
'hashpass': data['fields'].get('mot_de_passe').get('cleartext'),
'dateNaissance': date_de_naissance,
'actif': 'on',
- 'bibliotheque': {'id': data['fields'].get('bibliotheque_raw')},
- 'abonnements': '15',
+ 'bibliotheque': {'id': bibliotheque_id},
+ 'abonnements': abonnements,
}
return self.get_object().post_api('adherents', adherent)
--
2.1.4

View File

@ -28,6 +28,7 @@ Source5: synchro-cron.sh
Source6: wcs-au-quotidien.cron.d
Source7: passerelle-manage
Source8: cg14_config.py
Patch1: 0001-bdp-add-parameters-to-post-adherent-6577.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