示例#1
0
def RObjectType(tool, type):
    if type == 'input':
        if tool.input_type in inputConverters.keys():
            object = inputConverters[tool.input_type]
        else:
            object = inputConverters['default']
    else:
        if tool.output_type in outputConverters.keys():
            object = outputConverters[tool.output_type]
        else:
            object = outputConverters['default']
    return re.sub('\n.*', '', object, count=0) 
示例#2
0
def RObjectType(tool, type):
    if type == 'input':
        if tool.input_type in inputConverters.keys():
            object = inputConverters[tool.input_type]
        else:
            object = inputConverters['default']
    else:
        if tool.output_type in outputConverters.keys():
            object = outputConverters[tool.output_type]
        else:
            object = outputConverters['default']
    return re.sub('\n.*', '', object, count=0) 
示例#3
0
def getConverter(request, url):
    if not request.method == 'POST':
        return HttpResponse('ERROR: query must be an HTTP POST\n',
                            content_type='text/plain')
    converterType = request.POST['converterType']
    toolName = request.POST['toolName']
    if converterType == 'input':
        mimeType = Application.objects.get(name=toolName).input_type
        if mimeType in inputConverters.keys():
            result = inputConverters[mimeType]
        else:
            result = inputConverters['default']
    else:
        mimeType = Application.objects.get(name=toolName).output_type
        if mimeType in outputConverters.keys():
            result = outputConverters[mimeType]
        else:
            result = outputConverters['default']
    return HttpResponse(result, content_type='text/plain')
示例#4
0
def getConverter(request, url):
    if not request.method == 'POST':
        return HttpResponse('ERROR: query must be an HTTP POST\n',
                            mimetype='text/plain')
    converterType = request.POST['converterType']
    toolName = request.POST['toolName']
    if converterType == 'input':
        mimeType = Application.objects.get(name=toolName).input_type
        if mimeType in inputConverters.keys():
            result = inputConverters[mimeType]
        else:
            result = inputConverters['default']
    else:
        mimeType = Application.objects.get(name=toolName).output_type
        if mimeType in outputConverters.keys():
            result = outputConverters[mimeType]
        else:
            result = outputConverters['default']
    return HttpResponse(result, mimetype='text/plain')