示例#1
0
    def put(self, request, *args, **kwargs):
        try:
            log.info("Put - Fabric")

            if not request.DATA.get('fabric'):
                raise exceptions.InvalidInputException()
            #validar o json

            fabric_id = kwargs.get('fabric_id')
            fabric = request.DATA.get('fabric')

            if fabric.get("flag"):
                fabrics = facade.update_fabric_config(fabric_id, fabric)
            else:
                fabrics = facade.edit_dcrooms(fabric_id, fabric)

            fabric_serializer = DCRoomSerializer(fabrics)
            data = dict()
            data['fabric'] = fabric_serializer.data

            return Response(data, status=status.HTTP_200_OK)
        except Exception, e:
            raise api_exceptions.NetworkAPIException(e)
示例#2
0
    def put(self, request, *args, **kwargs):
        try:
            log.info("Put - Fabric")

            if not request.DATA.get('fabric'):
                raise exceptions.InvalidInputException()
            #validar o json

            fabric_id = kwargs.get('fabric_id')
            fabric = request.DATA.get('fabric')

            if fabric.get("flag"):
                fabrics = facade.update_fabric_config(fabric_id, fabric)
            else:
                fabrics = facade.edit_dcrooms(fabric_id, fabric)

            fabric_serializer = DCRoomSerializer(fabrics)
            data = dict()
            data['fabric'] = fabric_serializer.data

            return Response(data, status=status.HTTP_200_OK)
        except Exception, e:
            raise api_exceptions.NetworkAPIException(e)