config.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:gwot-physical 作者: JanVan01 项目源码 文件源码
def complete_config(self):
        if (request.method == 'GET'):
            data = {}
            data['name'] = self.config.get_name()
            data['interval'] = self.config.get_interval()
            data['location'] = self._get_location(self.config.get_location())
            return self.get_view(template_file='config.html').data(data)
        elif (request.method == 'PUT'):
            input = request.get_json()
            if(input is None):
                return self.get_view().bad_request('expected json')
            try:
                if ('name' in input):
                    self.config.set_name(str(input['name']))
                if ('interval' in input):
                    self.config.set_interval(int(input['interval']))
                if ('location' in input):
                    self.config.set_location(int(input['location']))
            except ValueError:
                return self.get_view().bad_request('Input not in the right format')
            return self.get_view().success()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号