Exemplo n.º 1
0
def update(request):
    """
    Importing scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')

    if domains and gittrees:
        domains_str, gittrees_str = domains.read(), gittrees.read()
        detail = check_scm(domains_str, gittrees_str)
        if not detail:
            log.info('Importing scm data...')
            scm_str = ''.join([domains_str, os.linesep, os.linesep,
                               gittrees_str])
            scm.from_string(scm_str)
            cache.clear()
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
Exemplo n.º 2
0
def update(request):
    """
    Importing scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')

    if domains and gittrees:
        domains_str, gittrees_str = domains.read(), gittrees.read()
        detail = check_scm(domains_str, gittrees_str)
        if not detail:
            log.info('Importing scm data...')
            scm_str = ''.join(
                [domains_str, os.linesep, os.linesep, gittrees_str])
            scm.from_string(scm_str)
            cache.clear()
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
Exemplo n.º 3
0
def check(request):
    """
    Checking scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')
    if domains and gittrees:
        log.info('Checking scm data...')
        detail = check_scm(domains.read(), gittrees.read())
        if not detail:
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
Exemplo n.º 4
0
def check(request):
    """
    Checking scm data
    """
    domains = request.FILES.get('domains')
    gittrees = request.FILES.get('gittrees')
    if domains and gittrees:
        log.info('Checking scm data...')
        detail = check_scm(domains.read(), gittrees.read())
        if not detail:
            detail = 'Successful!'
            code = status.HTTP_200_OK
        else:
            code = status.HTTP_406_NOT_ACCEPTABLE
            detail = ','.join(detail)
            log.error(detail)
    else:
        detail = 'Can not find data files!'
        code = status.HTTP_406_NOT_ACCEPTABLE
        log.error(detail)
    content = {'detail': detail}
    return Response(content, status=code)
Exemplo n.º 5
0
def file_import(domain_file, gittree_file):
    """
    read domain and git-tree file.
    """
    res = check_scm(domain_file.read(), gittree_file.read())
    return res
Exemplo n.º 6
0
def file_import(domain_file, gittree_file):
    """
    read domain and git-tree file.
    """
    res = check_scm(domain_file.read(), gittree_file.read())
    return res