Beispiel #1
0
 def _do_combine(self, data):
     '''
       e.g. ID2=2
     '''
     user2 = userop.get_user(int(data['ID2']))
     user = userop.get_user(self.__ID)
     res = {}
     if user2:
         accounts = user2.accounts
         for acc in accounts:
             acc.owner = user
             acc.put()
         user2.delete()
         res = {'OK': 'Combine successfully!'}
     else:
         res = {'_error': 'The second user is not existed!'}
     return res
Beispiel #2
0
 def _do_combine(self, data):
     '''
       e.g. ID2=2
     '''
     user2 = userop.get_user(int(data['ID2']))
     user = userop.get_user(self.__ID)
     res = {}
     if user2:
         accounts = user2.accounts
         for acc in accounts:
             acc.owner = user
             acc.put()
         user2.delete()
         res = {'OK': 'Combine successfully!'}
     else:
         res = {'_error': 'The second user is not existed!'}
     return res
Beispiel #3
0
 def get(self):
     """Params
        account_type, account_name"""
     try:
         self.response.headers['Content-Type'] = 'text/plain'
         account_type = self.request.get('account_type')
         account_name = self.request.get('account_name')
         
         req = {'account_type': account_type, 
                'account_name': account_name}
         account = userop.get_account(req)
         
         res = {'ID':''}
         if account:
             res['ID'] = str(userop.get_user(account).ID)
         else:
             res['ID'] = 'None'
     except:
         res = util.Error_Bad_Request
         
     self.response.write(code.object_to_xml(res).toxml())