Commit 24b6b732 authored by Mickaël Desfrênes's avatar Mickaël Desfrênes
Browse files

source format

parent 6ed0481e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ CORS_ALLOW_HEADERS = [
    "X-file-hash",
    "X-file-name",
    "X-origin-dir",
    "X-Project"
    "X-Project",
]

ROOT_URLCONF = "mediatheque.urls"
+3 −3
Original line number Diff line number Diff line
@@ -6,13 +6,13 @@ from django.db import migrations, models
class Migration(migrations.Migration):

    dependencies = [
        ('resources', '0019_alter_collection_project'),
        ("resources", "0019_alter_collection_project"),
    ]

    operations = [
        migrations.AddField(
            model_name='project',
            name='admin_mail',
            model_name="project",
            name="admin_mail",
            field=models.EmailField(max_length=254, null=True),
        ),
    ]
+44 −0
Original line number Diff line number Diff line
from django.core.management.base import BaseCommand, CommandError
from rpc import methods
from inspect import getmembers, isfunction, signature


TPL = '''
@_rpc_groups({})
def {}{}:
    """
    {}
    """
    _jama_api_key = APIKey.objects.filter(user=user).first()
    jama = JamaClient(settings.ATLAS_JAMA_RPC_ENDPOINT, _jama_api_key)
    return jama.{}({})
'''


class Command(BaseCommand):
    def handle(self, *args, **options):
        signatures = {}
        for fn_name, _ in getmembers(methods, isfunction):
            signatures[fn_name] = getattr(methods, fn_name)
        for key in sorted(signatures.keys()):
            if key[0:1] == "_":
                continue
            sign = signature(getattr(methods, key))
            keep_params = []
            for param in list(sign.parameters.items())[1:]:
                keep_params.append(param[0])
            shortened_signature = (
                str(sign)
                .replace("user: django.contrib.auth.models.User", "user: User")
                .replace("NoneType", "None")
            )
            print(
                TPL.format(
                    getattr(methods, key).rpc_groups,
                    key,
                    shortened_signature,
                    getattr(methods, key).__doc__.strip(),
                    key,
                    ", ".join(keep_params),
                )
            )
+1 −1
Original line number Diff line number Diff line
@@ -2,4 +2,4 @@ from django.apps import AppConfig


class VuejamaConfig(AppConfig):
    name = 'vuejama'
    name = "vuejama"