Projet

Général

Profil

0001-iparapheur-add-a-field-to-override-endpoint-location.patch

Nicolas Roche, 04 mars 2019 15:24

Télécharger (3,14 ko)

Voir les différences:

Subject: [PATCH] iparapheur: add a field to override endpoint location on wsdl
 (#30258)

 .../0006_iparapheur_wsdl_endpoint_location.py | 20 +++++++++++++++++++
 passerelle/contrib/iparapheur/models.py       |  3 +++
 passerelle/contrib/iparapheur/soap.py         |  8 ++++++--
 3 files changed, 29 insertions(+), 2 deletions(-)
 create mode 100644 passerelle/contrib/iparapheur/migrations/0006_iparapheur_wsdl_endpoint_location.py
passerelle/contrib/iparapheur/migrations/0006_iparapheur_wsdl_endpoint_location.py
1
# -*- coding: utf-8 -*-
2
# Generated by Django 1.11.18 on 2019-02-27 17:28
3
from __future__ import unicode_literals
4

  
5
from django.db import migrations, models
6

  
7

  
8
class Migration(migrations.Migration):
9

  
10
    dependencies = [
11
        ('iparapheur', '0005_remove_iparapheur_log_level'),
12
    ]
13

  
14
    operations = [
15
        migrations.AddField(
16
            model_name='iparapheur',
17
            name='wsdl_endpoint_location',
18
            field=models.CharField(blank=True, help_text='override WSDL endpoint location', max_length=256, verbose_name='WSDL endpoint location'),
19
        ),
20
    ]
passerelle/contrib/iparapheur/models.py
70 70
    wsdl_url = models.CharField(max_length=128, blank=False,
71 71
            verbose_name=_('WSDL URL'),
72 72
            help_text=_('WSDL URL'))
73
    wsdl_endpoint_location = models.CharField(max_length=256, blank=True,
74
            verbose_name=_('WSDL endpoint location'),
75
            help_text=_('override WSDL endpoint location'))
73 76
    verify_cert = models.BooleanField(default=True,
74 77
            verbose_name=_('Check HTTPS Certificate validity'))
75 78
    username = models.CharField(max_length=128, blank=True,
passerelle/contrib/iparapheur/soap.py
89 89

  
90 90
def get_client(instance):
91 91
    transport = Transport(instance)
92
    return Client(instance.wsdl_url, transport=transport,
93
                  plugins=[Handlewsdl(), Filter()], cache=None)
92
    client = Client(instance.wsdl_url, transport=transport,
93
                    plugins=[Handlewsdl(), Filter()], cache=None)
94
    # overrides the service port address URL defined in the WSDL.
95
    if instance.wsdl_endpoint_location:
96
        client.set_options(location=instance.wsdl_endpoint_location)
97
    return client
94 98

  
95 99
def get_wsdl_string(instance):
96 100
    '''download wsdl like suds's DocumentReader does it (but do not parse it)'''
97
-