Exemple #1
0
 def _do_delete(self, data):
     '''
       e.g. account_type=sina&access_name=XXXXXXXX
     '''
     res = {}
     account = userop.get_account(data)
     if account:
         account.delete()
         res['OK'] = 'Delete successfully!'
     else:
         res['_error'] = 'The account is not existed!'
     return res
Exemple #2
0
 def _do_delete(self, data):
     '''
       e.g. account_type=sina&access_name=XXXXXXXX
     '''
     res = {}
     account = userop.get_account(data)
     if account:
         account.delete()
         res['OK'] = 'Delete successfully!'
     else:
         res['_error'] = 'The account is not existed!'
     return res
Exemple #3
0
 def _do_add(self, data):
     '''
       e.g. account_type=sina&account_name=XXXXXXXX&access_token=XXXXXXXXX
         expire_in=XXXX
     '''
     res = {}
     if userop.get_account(data):
         res['_error'] = 'The account has already existed!'
         return res
     userop.insert_data(data, ID=self.__ID)
     res['OK'] = 'Add successfully!'
     res = data
     return res
Exemple #4
0
 def _do_add(self, data):
     '''
       e.g. account_type=sina&account_name=XXXXXXXX&access_token=XXXXXXXXX
         expire_in=XXXX
     '''
     res = {}
     if userop.get_account(data):
         res['_error'] = 'The account has already existed!'
         return res
     userop.insert_data(data, ID = self.__ID)
     res['OK'] = 'Add successfully!'
     res = data
     return res
Exemple #5
0
 def get(self):
     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)
     
     if account:
         has_expired = getattr(self, '_do_%s' % account_type)(account)
         res = {'result': has_expired}
     else:
         res = util.Error_Bad_Request
     
     self.response.write(code.object_to_xml(res).toxml())
Exemple #6
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())