Exemplo n.º 1
0
def confirmImageUpload (eventName):
  imageName = request.form ['imageName']
  ## Should we store image again?
  image = request.files ['image']
  app.logger.debug ('confirmImageUpload : ' + imageName + ' : '+ eventName)
  x = dbMgr.isEventPresent (eventName)
  if x == -1:
    return jsonify (status = 'True')
  x = dbMgr.insertNewImage (imageName, eventName)
  if x == 0:
    x = dbMgr.deleteImagePromise (imageName)
    return jsonify (status = 'True')
  else:
    return jsonify (status = 'False') 
Exemplo n.º 2
0
def addNewImage (eventName, imageName, imagePath):
  x = dbMgr.isImageNamePresent(imageName)
  if x == 0:
    x = srvMgr.canIUpload (eventName, imageName)
    if x == 1:
      x = dbMgr.insertNewImage(imageName, eventName)
      if x == 0:
        y = srvMgr.confirmUpload (eventName, imageName, imagePath)
        if y == 0:
          return 1
        else:
          srvMgr.releaseUploadPromise (eventName, imageName)
          dbMgr.deleteImageName (imageName)
    else:
      srvMgr.releaseUploadPromise (eventName, imageName)
  return 0