misc: apply pre-commit-hooks (#74981)
This commit is contained in:
parent
9245b8cf49
commit
3b2c713a8e
|
@ -2,12 +2,13 @@ Source: passerelle-minint
|
|||
Maintainer: Entr'ouvert <info@entrouvert.com>
|
||||
Section: python
|
||||
Priority: optional
|
||||
Build-Depends: dh-python, debhelper-compat (= 12), python3-setuptools, python3-all
|
||||
Build-Depends: debhelper-compat (= 12),
|
||||
dh-python,
|
||||
python3-all,
|
||||
python3-setuptools,
|
||||
Standards-Version: 3.9.1
|
||||
|
||||
Package: python3-passerelle-minint
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends},
|
||||
${python3:Depends},
|
||||
python3-suds
|
||||
Depends: python3-suds, ${misc:Depends}, ${python3:Depends}
|
||||
Description: Passerelle MinInt Connectors (Python 3)
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.18 on 2020-05-04 13:59
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# coding=utf-8
|
||||
import requests
|
||||
from django.db import models
|
||||
from django.utils.http import urlquote
|
||||
|
@ -37,13 +36,13 @@ class Brexit(BaseResource):
|
|||
try:
|
||||
response = self.requests.get(self.url + '/%s/%s' % (num, email), verify=False)
|
||||
except requests.RequestException as e:
|
||||
raise APIError(u'API-maarch connection error: %s' % exception_to_text(e), data=[])
|
||||
raise APIError('API-maarch connection error: %s' % exception_to_text(e), data=[])
|
||||
try:
|
||||
data = response.json()
|
||||
except ValueError as e:
|
||||
content = repr(response.content[:1000])
|
||||
raise APIError(
|
||||
u'API-maarch returned non-JSON content with status %s: %s' % (response.status_code, content),
|
||||
'API-maarch returned non-JSON content with status %s: %s' % (response.status_code, content),
|
||||
data={
|
||||
'status_code': response.status_code,
|
||||
'exception': exception_to_text(e),
|
||||
|
@ -57,7 +56,7 @@ class Brexit(BaseResource):
|
|||
'err_desc': data.get('message', 'not-found'),
|
||||
}
|
||||
raise APIError(
|
||||
u'API-maarch returned a non 200 status %s: %s' % (response.status_code, data),
|
||||
'API-maarch returned a non 200 status %s: %s' % (response.status_code, data),
|
||||
data={
|
||||
'status_code': response.status_code,
|
||||
'content': data,
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.18 on 2020-05-01 00:16
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
@ -5,21 +5,21 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block endpoints %}
|
||||
<ul>
|
||||
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'minint-maarch-ping' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-ping' slug=object.slug %}</a>[?debug]</li>
|
||||
<li>{% trans 'Store a resource:' %} POST <a href="{% url 'minint-maarch-resource' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-resource' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
<li>Ajout d'un fichier à un dossier existant POST <a href="{% url 'minint-maarch-attachment' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-attachment' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
<li>[DEBUG] {% trans 'Store a resource:' %} POST <a href="{% url 'minint-maarch-debug' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-debug' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'minint-maarch-ping' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-ping' slug=object.slug %}</a>[?debug]</li>
|
||||
<li>{% trans 'Store a resource:' %} POST <a href="{% url 'minint-maarch-resource' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-resource' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
<li>Ajout d'un fichier à un dossier existant POST <a href="{% url 'minint-maarch-attachment' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-attachment' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
<li>[DEBUG] {% trans 'Store a resource:' %} POST <a href="{% url 'minint-maarch-debug' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-maarch-debug' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block security %}
|
||||
<p>
|
||||
{% trans 'Access is limited to the following API users:' %}
|
||||
</p>
|
||||
{% access_rights_table resource=object permission='can_access' %}
|
||||
<p>
|
||||
{% trans 'Access is limited to the following API users:' %}
|
||||
</p>
|
||||
{% access_rights_table resource=object permission='can_access' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<slug>[\w,-]+)/$', MaarchDetailView.as_view(), name='minint-maarch-view'),
|
||||
url(r'^(?P<slug>[\w,-]+)/ping/$', PingView.as_view(), name='minint-maarch-ping'),
|
||||
url(r'^(?P<slug>[\w,-]+)/resource/$', ResourceView.as_view(), name='minint-maarch-resource'),
|
||||
url(r'^(?P<slug>[\w,-]+)/attachment/$', AttachmentView.as_view(), name='minint-maarch-attachment'),
|
||||
url(r'^(?P<slug>[\w,-]+)/debug/$', DebugView.as_view(), name='minint-maarch-debug'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/$', MaarchDetailView.as_view(), name='minint-maarch-view'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/ping/$', PingView.as_view(), name='minint-maarch-ping'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/resource/$', ResourceView.as_view(), name='minint-maarch-resource'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/attachment/$', AttachmentView.as_view(), name='minint-maarch-attachment'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/debug/$', DebugView.as_view(), name='minint-maarch-debug'),
|
||||
]
|
||||
|
|
|
@ -99,7 +99,7 @@ class PingView(DetailView):
|
|||
class ResourceView(DetailView):
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(ResourceView, self).dispatch(*args, **kwargs)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
@utils.protected_api('can_access')
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
@ -398,7 +398,7 @@ class ResourceView(DetailView):
|
|||
class AttachmentView(DetailView):
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(AttachmentView, self).dispatch(*args, **kwargs)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
@utils.protected_api('can_access')
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
@ -513,7 +513,7 @@ class AttachmentView(DetailView):
|
|||
class DebugView(DetailView):
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(DebugView, self).dispatch(*args, **kwargs)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
@utils.protected_api('can_access')
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.18 on 2020-05-01 00:17
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
|
|
@ -5,17 +5,17 @@
|
|||
{% endblock %}
|
||||
|
||||
{% block endpoints %}
|
||||
<ul>
|
||||
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'minint-seisin-by-email-ping' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-seisin-by-email-ping' slug=object.slug %}</a>[?debug]</li>
|
||||
<li>{% trans 'Send a resource by email:' %} POST <a href="{% url 'minint-seisin-by-email-resource' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-seisin-by-email-resource' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
</ul>
|
||||
<ul>
|
||||
<li>{% trans 'Check WSDL availability:' %} <a href="{% url 'minint-seisin-by-email-ping' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-seisin-by-email-ping' slug=object.slug %}</a>[?debug]</li>
|
||||
<li>{% trans 'Send a resource by email:' %} POST <a href="{% url 'minint-seisin-by-email-resource' slug=object.slug %}"
|
||||
>{{ site_base_uri }}{% url 'minint-seisin-by-email-resource' slug=object.slug %}</a> (payload: JSON w.c.s. formdata)</li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
{% block security %}
|
||||
<p>
|
||||
{% trans 'Access is limited to the following API users:' %}
|
||||
</p>
|
||||
{% access_rights_table resource=object permission='can_access' %}
|
||||
<p>
|
||||
{% trans 'Access is limited to the following API users:' %}
|
||||
</p>
|
||||
{% access_rights_table resource=object permission='can_access' %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -14,12 +14,14 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from django.conf.urls import include, url
|
||||
from django.urls import re_path
|
||||
|
||||
from .views import *
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^(?P<slug>[\w,-]+)/$', SeisinManagementDetailView.as_view(), name='minint-seisin-by-email-view'),
|
||||
url(r'^(?P<slug>[\w,-]+)/ping/$', PingView.as_view(), name='minint-seisin-by-email-ping'),
|
||||
url(r'^(?P<slug>[\w,-]+)/resource/$', ResourceView.as_view(), name='minint-seisin-by-email-resource'),
|
||||
re_path(
|
||||
r'^(?P<slug>[\w,-]+)/$', SeisinManagementDetailView.as_view(), name='minint-seisin-by-email-view'
|
||||
),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/ping/$', PingView.as_view(), name='minint-seisin-by-email-ping'),
|
||||
re_path(r'^(?P<slug>[\w,-]+)/resource/$', ResourceView.as_view(), name='minint-seisin-by-email-resource'),
|
||||
]
|
||||
|
|
|
@ -58,7 +58,7 @@ class PingView(DetailView):
|
|||
class ResourceView(DetailView):
|
||||
@method_decorator(csrf_exempt)
|
||||
def dispatch(self, *args, **kwargs):
|
||||
return super(ResourceView, self).dispatch(*args, **kwargs)
|
||||
return super().dispatch(*args, **kwargs)
|
||||
|
||||
@utils.protected_api('can_access')
|
||||
def post(self, request, *args, **kwargs):
|
||||
|
|
2
setup.py
2
setup.py
|
@ -12,7 +12,7 @@ def get_version():
|
|||
tag exists, take 0.0- and add the length of the commit log.
|
||||
'''
|
||||
if os.path.exists('VERSION'):
|
||||
version_file = open('VERSION', 'r')
|
||||
version_file = open('VERSION')
|
||||
version = version_file.read()
|
||||
version_file.close()
|
||||
return version
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import json
|
||||
import urllib.parse
|
||||
from unittest import mock
|
||||
|
||||
import httmock
|
||||
import mock
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.urls import reverse
|
||||
from passerelle.base.models import AccessRight, ApiUser
|
||||
|
|
Loading…
Reference in New Issue