Exemple #1
0
def translate(request):
    path = handle_uploaded_file(request.FILES['path'])
    # path = 'c:\\tosca_helloworld.yaml'
    obj = TranslatorShell()
    content = obj._translate('tosca', path, {}, True)
    os.remove(path)
    print path
    with open(path, 'a') as the_file:
        for line in content.splitlines():
            the_file.write(line + '\n')
    return JsonResponse({'status': 'success', 'content': content, 'path': path})
Exemple #2
0
def translate_local(path, file):
    # path = 'c:\\tosca_helloworld.yaml'
    filename, file_extension = os.path.splitext(file)
    filename += ` random.random() ` + '_heat.yaml'
    obj = TranslatorShell()
    content = obj._translate('tosca', path, {}, True)
    targetpath = 'c:\\folder\\' + filename
    # targetpath = '/home/rdk/files/' + filename
    print path
    with open(targetpath, 'a') as the_file:
        for line in content.splitlines():
            the_file.write(line + '\n')
    return targetpath
Exemple #3
0
def translate_local(path, file):
    # path = 'c:\\tosca_helloworld.yaml'
    filename, file_extension = os.path.splitext(file)
    filename += `random.random()` + '_heat.yaml'
    obj = TranslatorShell()
    content = obj._translate('tosca', path, {}, True)
    targetpath = 'c:\\folder\\' + filename
    # targetpath = '/home/rdk/files/' + filename
    print path
    with open(targetpath, 'a') as the_file:
        for line in content.splitlines():
            the_file.write(line + '\n')
    return targetpath
Exemple #4
0
def translate(request):
    path = handle_uploaded_file(request.FILES['path'])
    # path = 'c:\\tosca_helloworld.yaml'
    obj = TranslatorShell()
    content = obj._translate('tosca', path, {}, True)
    os.remove(path)
    print path
    with open(path, 'a') as the_file:
        for line in content.splitlines():
            the_file.write(line + '\n')
    return JsonResponse({
        'status': 'success',
        'content': content,
        'path': path
    })
Exemple #5
0
from heat_translator_master.translator.shell import TranslatorShell

obj = TranslatorShell()
print obj._translate('tosca', 'C:\\tosca_nodejs_mongodb_two_instances.yaml', {}, True)