示例#1
0
 def delete(self, dataName):
     """
     ref: web_api.yaml
     :param dataName:
     :return:
     """
     data_name = utils.encode_if_unicode(dataName)
     data_service = DataService(data_name)
     if not data_service.exists():
         return self.render(msg='%s not found' % data_name, status=404)
     if not data_service.auth_edit():
         return self.render(msg='%s: data access forbidden' % data_name, status=403)
     data_service.delete()
     return self.render()
示例#2
0
    def put(self, dataName):
        """
        ref: web_api.yaml
        :param dataName:
        :return:
        """
        data_name = utils.encode_if_unicode(dataName)
        data_service = DataService(data_name)
        if not data_service.exists():
            return self.render(msg='%s not found' % data_name, status=404)
        if not data_service.auth_edit():
            return self.render(msg='%s: data access forbidden' % data_name,
                               status=403)
        start_time = g.args['startTime'] / 1000
        end_time = g.args['endTime'] / 1000
        label = g.args['label']

        data_service.set_label(start_time, end_time, label)

        return self.render()
示例#3
0
    def put(self, dataName):
        """
        ref: web_api.yaml
        :param dataName:
        :return:
        """
        data_name = utils.encode_if_unicode(dataName)
        data_service = DataService(data_name)
        if not data_service.exists():
            return self.render(msg='%s not found' % data_name, status=404)
        if not data_service.auth_edit():
            return self.render(msg='%s: data access forbidden' % data_name, status=403)
        plugin = Plugin(data_service)

        start_time = g.args['startTime'] / 1000
        end_time = g.args['endTime'] / 1000
        action = g.args['action']

        res = plugin(action, start_time, end_time)

        return self.render(data=res)