Example #1
0
        ## return data about the area resource
        ar = AreaResource()
        ar_item = ar.obj_get(pk=area.id)
        ar_bundle = ar.build_bundle(obj=ar_item, request=request)

        try:
            area_data = ar.full_dehydrate(ar_bundle).data
            response["data"].update(area_data)
        except ImmediateHttpResponse, error:
            return error.response

    elif env:
        ## return data about the environment resource
        envr = EnvironmentResource()
        envr_item = envr.obj_get(pk=env.id)
        envr_bundle = envr.build_bundle(obj=envr_item, request=request)

        try:
            env_data = envr.full_dehydrate(envr_bundle).data
            response["data"].update(env_data)
        except ImmediateHttpResponse, error:
            return error.response

        ## include the list of all areas that belong to this environment
        area_list = []
        for ar in env.areas.all():
            area_dict = {"name": ar.name, "resource_uri": AreaResource().get_resource_uri(ar)}

            ## check if there are tags for this area
            if ar.tags:
                area_dict["tags"] = ar.tags.getList()
Example #2
0
        ar = AreaResource()
        ar_bundle = ar.build_bundle()
        ar_item = ar.obj_get(ar_bundle, pk=area.id)
        ar_bundle.obj = ar_item
        ar_bundle.request = request

        try:
            area_data = ar.full_dehydrate(ar_bundle).data
            response['data'].update(area_data)
        except ImmediateHttpResponse, error:
            return error.response

    elif env:
        ## return data about the environment resource
        envr = EnvironmentResource()
        envr_bundle = envr.build_bundle()
        envr_item = envr.obj_get(envr_bundle, pk=env.id)
        envr_bundle.obj = envr_item
        envr_bundle.request = request

        try:
            env_data = envr.full_dehydrate(envr_bundle).data
            response['data'].update(env_data)
        except ImmediateHttpResponse, error:
            return error.response

        ## include the list of all areas that belong to this environment
        area_list = []
        for ar in env.areas.all():
            area_dict = {
                'name': ar.name,
Example #3
0
     ## return data about the area resource
     ar = AreaResource()
     ar_item = ar.obj_get(pk=area.id)
     ar_bundle = ar.build_bundle(obj = ar_item, request=request)
     
     try:
         area_data = ar.full_dehydrate(ar_bundle).data
         response['data'].update(area_data)
     except ImmediateHttpResponse, error:
         return error.response
     
 elif env:
     ## return data about the environment resource
     envr = EnvironmentResource()
     envr_item = envr.obj_get(pk=env.id)
     envr_bundle = envr.build_bundle(obj = envr_item, request=request)
     
     try:
         env_data = envr.full_dehydrate(envr_bundle).data
         response['data'].update(env_data)
     except ImmediateHttpResponse, error:
         return error.response
     
     ## include the list of all areas that belong to this environment
     area_list = []
     for ar in env.areas.all():
         area_dict = {'name': ar.name,
                      'resource_uri': AreaResource().get_resource_uri(ar)
                      }
         
         ## check if there are tags for this area