First commit
This commit is contained in:
commit
39a1e5cea1
|
@ -0,0 +1 @@
|
||||||
|
*.pyc
|
|
@ -0,0 +1,33 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Generated by Django 1.11.18 on 2019-10-11 04:29
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('base', '0015_auto_20190921_0347'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ReunionConnector',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(max_length=50, verbose_name='Title')),
|
||||||
|
('description', models.TextField(verbose_name='Description')),
|
||||||
|
('slug', models.SlugField(unique=True, verbose_name='Identifier')),
|
||||||
|
('server', models.CharField(max_length=128, verbose_name='DB server')),
|
||||||
|
('username', models.CharField(max_length=128, verbose_name='DB user')),
|
||||||
|
('password', models.CharField(blank=True, max_length=128, null=True, verbose_name='DB server')),
|
||||||
|
('users', models.ManyToManyField(blank=True, related_name='_reunionconnector_users_+', related_query_name='+', to='base.ApiUser')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'verbose_name': 'Connecteur de test r\xe9union',
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,24 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from django.db import models
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from passerelle.base.models import BaseResource
|
||||||
|
from passerelle.utils.api import endpoint
|
||||||
|
from passerelle.utils.jsonresponse import APIError
|
||||||
|
|
||||||
|
|
||||||
|
class ReunionConnector(BaseResource):
|
||||||
|
|
||||||
|
server = models.CharField(max_length=128, verbose_name=_('DB server'))
|
||||||
|
username = models.CharField(max_length=128, verbose_name=_('DB user'))
|
||||||
|
password = models.CharField(max_length=128, verbose_name=_('DB server'), null=True, blank=True)
|
||||||
|
|
||||||
|
category = 'Divers'
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
verbose_name = u'Connecteur de test réunion'
|
||||||
|
|
||||||
|
@endpoint(description_get=_('Ping'), methods=['get'], perm='can_access')
|
||||||
|
def ping(self, request):
|
||||||
|
return {'data': 'pong'}
|
|
@ -0,0 +1,49 @@
|
||||||
|
#! /usr/bin/env python
|
||||||
|
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
from distutils.command.sdist import sdist
|
||||||
|
|
||||||
|
|
||||||
|
class eo_sdist(sdist):
|
||||||
|
def run(self):
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
os.remove('VERSION')
|
||||||
|
version = get_version()
|
||||||
|
version_file = open('VERSION', 'w')
|
||||||
|
version_file.write(version)
|
||||||
|
version_file.close()
|
||||||
|
sdist.run(self)
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
os.remove('VERSION')
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
version_file = open('VERSION', 'r')
|
||||||
|
version = version_file.read()
|
||||||
|
version_file.close()
|
||||||
|
return version
|
||||||
|
if os.path.exists('.git'):
|
||||||
|
p = subprocess.Popen(['git', 'describe', '--dirty', '--match=v*'], stdout=subprocess.PIPE)
|
||||||
|
result = p.communicate()[0]
|
||||||
|
if p.returncode == 0:
|
||||||
|
version = result.split()[0][1:]
|
||||||
|
version = version.replace('-', '.')
|
||||||
|
return version
|
||||||
|
return '0'
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name='passerelle-cr-poc',
|
||||||
|
version=get_version(),
|
||||||
|
author='CR Reunion',
|
||||||
|
author_email='toto@example.net',
|
||||||
|
url='http://example.net/',
|
||||||
|
packages=find_packages(),
|
||||||
|
cmdclass={
|
||||||
|
'sdist': eo_sdist,
|
||||||
|
}
|
||||||
|
)
|
Reference in New Issue