Exemple #1
0
def annotation(request, webargs):
    """Get put object interface for RAMON objects"""
    [token, channel, rest] = webargs.split('/', 2)

    try:
        if request.method == 'GET':
            # check for json vs hdf5
            if rest.split('/')[1] == 'json':
                return django.http.HttpResponse(
                    ocpcarest.getAnnotation(webargs),
                    content_type="application/json")
            else:
                # return hdf5
                return django.http.HttpResponse(
                    ocpcarest.getAnnotation(webargs),
                    content_type="product/hdf5")
        elif request.method == 'POST':
            #if service == 'hdf5_async':
            #return django.http.HttpResponse( ocpcarest.putAnnotationAsync(webargs,request.body) )
            #else:
            return django.http.HttpResponse(
                ocpcarest.putAnnotation(webargs, request.body))
        elif request.method == 'DELETE':
            ocpcarest.deleteAnnotation(webargs)
            return django.http.HttpResponse("Success",
                                            content_type='text/html')
    except OCPCAError, e:
        return django.http.HttpResponseNotFound(e.value)
Exemple #2
0
def annotation (request, webargs):
  """Get put object interface for RAMON objects"""

  try:
    if request.method == 'GET':
      return django.http.HttpResponse(ocpcarest.getAnnotation(webargs), mimetype="product/hdf5" )
    elif request.method == 'POST':
      return django.http.HttpResponse(ocpcarest.putAnnotation(webargs,request.body))
    elif request.method == 'DELETE':
      ocpcarest.deleteAnnotation(webargs)
      return django.http.HttpResponse ("Success", mimetype='text/html')
  except OCPCAError, e:
    return django.http.HttpResponseNotFound(e.value)
Exemple #3
0
def annotation (request, webargs):
  """Get put object interface for RAMON objects"""
  [token, channel, rest] = webargs.split('/',2)
  
  try:
    if request.method == 'GET':
      # check for json vs hdf5 
      if rest.split('/')[1] == 'json':
        return django.http.HttpResponse(ocpcarest.getAnnotation(webargs), content_type="application/json" )
      else:
        # return hdf5 
        return django.http.HttpResponse(ocpcarest.getAnnotation(webargs), content_type="product/hdf5" )
    elif request.method == 'POST':
      #if service == 'hdf5_async':
        #return django.http.HttpResponse( ocpcarest.putAnnotationAsync(webargs,request.body) )
      #else:
      return django.http.HttpResponse(ocpcarest.putAnnotation(webargs,request.body))
    elif request.method == 'DELETE':
      ocpcarest.deleteAnnotation(webargs)
      return django.http.HttpResponse ("Success", content_type='text/html')
  except OCPCAError, e:
    return django.http.HttpResponseNotFound(e.value)