Example #1
0
 def status(self):
     from wpkit.basic import PointDict
     info = PointDict(current_branch=self.space.active_branch(),
                      branches=self.space.branch_list(),
                      status=self.space.status(silent=True))
     if self.space.active_branch() == 'master':
         info.store_keys = self.keys()
     # info.print()
     print(info)
     return info
Example #2
0
 def status(self, repo=None):
     repo = repo or self.repo
     from wpkit.basic import PointDict
     info = PointDict(current_branch=repo.active_branch(),
                      local_branches=repo.branch_list(),
                      status=repo.status())
     print(info)
     return info
Example #3
0
 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.")
Example #4
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
Example #5
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()
Example #6
0
File: piu.py Project: 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
Example #7
0
File: pan.py Project: Peiiii/wpkit
from wpkit.pan import Pan
p=Pan('./myspace')
import wpkit
from wpkit.basic import PointDict
cmd=PointDict(op='newFile',params=PointDict(filename='test.html',location='./myspace',content="yes"))
p.execute(cmd)
cmd=PointDict(op='synch')
p.execute(cmd)
Example #8
0
File: piu.py Project: Peiiii/wpkit
 def __setitem__(self, key, value):
     PointDict.__setitem__(self, key, value)
     self._save()
Example #9
0
File: piu.py Project: Peiiii/wpkit
 def __setattr__(self, key, value):
     PointDict.__setattr__(self, key, value)
     self._save()