コード例 #1
0
ファイル: LocalFSServer.py プロジェクト: Peiiii/wk
 def do_upload(info):
     file = request.files['file']
     if isinstance(info, str):
         info = json.loads(info)
     info = PointDict.from_dict(info)
     path = self.fs.local_path(info.location)
     path = self.fs.local_path(path + '/' + info.filename)
     file.save(path)
     print('path:', path)
     print('file:', file)
     return StatusSuccess(msg="Uploading succeeded.")
コード例 #2
0
 def execute(self, cmd):
     cmd = PointDict.from_dict(cmd)
     op, params = cmd.op, cmd.params
     # if 'location' in params.keys():
     #     params['location']=self.true_path(params['location'])
     if op in self.cmd_dict.keys():
         # print(self.cmd_dict[op](**params))
         # print("params:",params)
         res = self.cmd_dict[op](**params)
         # print("res:",res)
         return res
コード例 #3
0
 def wrapper(user_email, user_password, *args, **kwargs):
     if not (user_email and user_password):
         return self.login_page()
     user = self.get_user(user_email)
     user = PointDict.from_dict(user) if user else user
     if not user:
         return self.signup_page()
     if user and (user.user_email == user_email) and (user.user_password
                                                      == user_password):
         return f(*args, **kwargs)
     else:
         # return self.login_page()
         return self.error_page()
コード例 #4
0
ファイル: piu.py プロジェクト: Peiiii/wpkit
 def execute(self, cmd):
     cmd = PointDict.from_dict(cmd)
     op, params = cmd.op, cmd.params
     if op == 'add':
         res = self.add(params['key'], params['value'])
     elif op == 'set':
         res = self.set(params['key'], params['value'])
     elif op == 'get':
         res = self.get(params['key'], params.get('default', None))
     elif op == 'delete':
         res = self.delete(params['key'])
     else:
         assert op == 'recover'
         res = self.recover(params['key'], params['step'])
     return res