Пример #1
0
	def gen_delete_msg(self,sql_str,ids):
		action_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
		repo = WeixinDB()
		count = 0
		with repo:
			for msg_id in ids:
				try:
					if repo.execute_delete(sql_str,(int(msg_id))):
						count = count + 1
				except Exception, e:
					print e
					print ' at %s' % (action_time)
			print 'delete %d messages at %s from WeixinDB' %(count,action_time)
			if count == len(ids):
				return True
			else:
				return False