def post(self): user = self.request.get('user', 'NULL') password = self.request.get('password', 'NULL') seed = int(self.request.get('seed', '1000000')) number = int(self.request.get('number', '1')) pf = self.request.get('pf', 'TB') if self.user_key == user and self.password_key == password: last = getLastSeed(pf) if last == -1: logging.info ('last failed') else: if last + 1 < seed: # seed is bigger than last, update last to seed. But there will be a delta bigger than one in the nimbers, should be avoided logging.info ('in createID function seed of %s is bigger than last of %s'%(last, seed)) last = seed res = taghash.generateTagIds(last+1, number, pf, self.key ) if res and len(res) > 0: m_res = writetoDB(res, pf) if m_res > 0: logging.info('the numbers of records written to the DB are %s'%m_res) else: logging.error('there was an error number %s'%m_res) else: logging.error('taghash failed to return values')
def post(self): user = self.request.get('user', 'NULL') password = self.request.get('password', 'NULL') seed = int(self.request.get('seed', '0')) number = int(self.request.get('number', '1')) pf = self.request.get('pf', 'AA') if self.user_key == user and self.password_key == password: last = seed if last == 0: last = IDtable.All().count() res = taghash.generateTagIds(last+1, number, pf, constants.HASH_KEY ) if res and len(res) > 0: m_res = writeIDtoDB(res, pf) if m_res > 0: logging.info('the numbers of records written to the DB are %s'%m_res) else: logging.error('there was an error number %s'%m_res) else: logging.error('taghash failed to return values')