Ejemplo n.º 1
0
def deletefileinvessel(vesselname,filename):
  if vesselname not in vesseldict:
    raise BadRequest, "No such vessel"
  
  if filename.startswith("private_"):
    raise BadRequest("User is not allowed to use file names starting with 'private_'")

  try:
    check_repy_filename(filename)
  except TypeError, e:
    raise BadRequest(str(e))
Ejemplo n.º 2
0
def deletefileinvessel(vesselname, filename):
    if vesselname not in vesseldict:
        raise BadRequest, "No such vessel"

    if filename.startswith("private_"):
        raise BadRequest(
            "User is not allowed to use file names starting with 'private_'")

    try:
        check_repy_filename(filename)
    except RepyArgumentError, e:
        raise BadRequest(str(e))
Ejemplo n.º 3
0
def addfiletovessel(vesselname,filename, filedata):
  if vesselname not in vesseldict:
    raise BadRequest, "No such vessel"

  # The user is restricted from using filename starting with 'private_' since
  # this part of the namespace is reserved for custom security layers.
  if filename.startswith("private_"):
    raise BadRequest("User is not allowed to use file names starting with 'private_'")

  # get the current amount of data used by the vessel...
  currentsize = nonportable.compute_disk_use(vesselname+"/")
  # ...and the allowed amount
  resourcedict, call_list = resourcemanipulation.read_resourcedict_from_file(vesseldict[vesselname]['resourcefilename'])

  # If the current size + the size of the new data is too large, then deny
  if currentsize + len(filedata) > resourcedict['diskused']:
    raise BadRequest("Not enough free disk space")
  
  try:
    check_repy_filename(filename)
  except TypeError, e:
    raise BadRequest(str(e))
Ejemplo n.º 4
0
def addfiletovessel(vesselname, filename, filedata):
    if vesselname not in vesseldict:
        raise BadRequest, "No such vessel"

    # The user is restricted from using filename starting with 'private_' since
    # this part of the namespace is reserved for custom security layers.
    if filename.startswith("private_"):
        raise BadRequest(
            "User is not allowed to use file names starting with 'private_'")

    # get the current amount of data used by the vessel...
    currentsize = nonportable.compute_disk_use(vesselname + "/")
    # ...and the allowed amount
    resourcedict, call_list = resourcemanipulation.read_resourcedict_from_file(
        vesseldict[vesselname]['resourcefilename'])

    # If the current size + the size of the new data is too large, then deny
    if currentsize + len(filedata) > resourcedict['diskused']:
        raise BadRequest("Not enough free disk space")

    try:
        check_repy_filename(filename)
    except RepyArgumentError, e:
        raise BadRequest(str(e))