Ejemplo n.º 1
0
def createFolder():
    # First grab our path
    path = request.values['path'].strip("/")

    # Add the event to the queue
    event = requestEvent(params=(path),
                         requestFunction=requestHandlers.createFolder)
    eventQueue.put(event)

    # Wait till the event is done
    while (not event.isDone):
        time.sleep(0.1)

    # Return the event and its status code
    return Response(status=event.status_code, response=event.response)
Ejemplo n.º 2
0
def retriveFileLastModified():
    # First grab our path
    path = request.values['path']

    # Add the event to the queue
    event = requestEvent(
        params=(path), requestFunction=requestHandlers.retriveFileLastModified)
    eventQueue.put(event)

    # Wait till the event is done
    while (not event.isDone):
        time.sleep(1)

    # Return the event and its status code
    return Response(status=event.status_code, response=event.response)
Ejemplo n.º 3
0
def moveFile():
    # Grab our origin and destination
    origin = request.values['origin'].strip("/")
    destination = request.values['destination'].strip("/")

    # Add the event to the queue
    event = requestEvent(params=(origin, destination),
                         requestFunction=requestHandlers.moveFile)
    eventQueue.put(event)

    # Wait till the event is done
    while (not event.isDone):
        time.sleep(1)

    # Return the event and its status code
    return Response(status=event.status_code, response=event.response)
Ejemplo n.º 4
0
def uploadFile():
    # First grab our file and path
    toUpload = request.files['file']
    path = request.values['path'].strip("/")

    # Add the event to the queue
    event = requestEvent(params=path,
                         requestFunction=requestHandlers.uploadFile,
                         fileToUpload=toUpload,
                         uploadsFile=True)
    eventQueue.put(event)

    # Wait till the event is done
    while (not event.isDone):
        time.sleep(1)

    # Return the event and its status code
    return Response(status=event.status_code, response=event.response)
Ejemplo n.º 5
0
def retriveFile():
    # First grab our path
    path = request.values['path']

    # Add the event to the queue
    event = requestEvent(params=(path),
                         requestFunction=requestHandlers.retriveFile,
                         returnsFile=True)
    eventQueue.put(event)

    # Wait till the event is done
    while (not event.isDone):
        time.sleep(1)

    # Return the event and its status code
    if (event.status_code == 200):
        return send_file(event.absolutePath,
                         attachment_filename=event.attachment_filename)

    # Unless an error came up
    return Response(status=event.status_code, response=event.response)