當前位置: 首頁>>代碼示例>>Python>>正文


Python LOG.error方法代碼示例

本文整理匯總了Python中gl.LOG.error方法的典型用法代碼示例。如果您正苦於以下問題:Python LOG.error方法的具體用法?Python LOG.error怎麽用?Python LOG.error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在gl.LOG的用法示例。


在下文中一共展示了LOG.error方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_systematics

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def get_systematics(question_id):
		
		mysql = Mysql()

		mysql.connect_master()
		
		query_sql = "select D.name as module_name,C.name as unit_name,B.name as topic_name from (select topic_id from link_question_topic where question_id=%(question_id)d)A left outer join (select id,name,unit_id from entity_topic)B on (A.topic_id=B.id) left outer join (select id,name,module_id from entity_unit)C on (B.unit_id=C.id) left outer join (select id,name from entity_module)D on (C.module_id=D.id);" 
		
		try:
			if mysql.query(query_sql,question_id = int(question_id)):

				res = mysql.fetchall()
				systematics_list = []

				for line in res:
					module = line[0]
					unit = line[1]
					topic = line[2]					
					systematics_dict = {'module':module,'unit':unit,'topic':topic}
					systematics_list.append(systematics_dict)

				return systematics_list
			else:
				return False

		except DBException as e:
			LOG.error('get systematics error [%s]' % e)
			raise CKException('get systematics error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:30,代碼來源:business.py

示例2: _upload_qiniu

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def _upload_qiniu(self,ori_url):
		from gl import LOG
		LOG.info('Original Image Url [%s]' % ori_url)
		if not self.img_url_exp.match(ori_url):
			suffix = ori_url[ori_url.rfind('.'):]	
			qiniu_file_name = md5(ori_url).hexdigest() + suffix
			
			LOG.info('Open Refer Imgage[%s]' % ori_url)

			request = urllib2.Request(ori_url)
			response = urllib2.urlopen(request)
			img_data =  response.read()

			#LOG.info('img data [%s]' % img_data)	

			qiniu = QiniuWrap()
			res = qiniu.upload_data('qdimg',qiniu_file_name,img_data)

			if not res:
				qiniu_url = self.qiniu_prefix % ('qdimg',qiniu_file_name)
				LOG.info('[%s] local [%s] successful' % (ori_url,qiniu_url))			
				return qiniu_url
			else:
				LOG.error('upload qiniu error [%s]' % res)
				return None
開發者ID:XDF-server,項目名稱:doit,代碼行數:27,代碼來源:interface.py

示例3: connect_master

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def connect_master(self):

		if self.connect_flag:
			self.cur.close()
			self.conn.close()		
			self.connect_flag = False

		configer = Configer()
	
		host = configer.get_configer('MYSQL','host')
		port = configer.get_configer('MYSQL','port')
		user = configer.get_configer('MYSQL','user')
		passwd = configer.get_configer('MYSQL','passwd')
		db = configer.get_configer('MYSQL','db')
		charset = configer.get_configer('MYSQL','charset')

		try:
			self.conn = MySQLdb.connect(
					host = host,
					port = int(port),
					user = user,
					passwd = passwd,
					db = db,
					charset = charset)
			
			self.cur = self.conn.cursor()
			self.connect_flag = True

		except MySQLdb.Error,e:
			self.status = self.status_enum.CONN_ERR
			msg = 'connect failed'
			LOG.error('Error:%s' % str(e))
			raise DBException(msg)
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:35,代碼來源:mysql.py

示例4: q_mark_list

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def q_mark_list():

		mysql = Mysql()
		
		mysql.connect_master()

		query_sql = "select id,name from link_question_mark where enable=1;"	

		mark_list = []

		try:
			if mysql.query(query_sql):
				mark_tuple =  mysql.fetchall()
				
				for mark in mark_tuple:
					tmp_tuple = (mark[0],mark[1])
					mark_list.append(tmp_tuple)
				return mark_list

			else:
				return None

		except DBException as e:
			LOG.error('get mark error [%s]' % e)
			raise CkException('get mark error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:27,代碼來源:business.py

示例5: q_subject_list

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def q_subject_list():

		mysql = Mysql()
		
		mysql.connect_master()

		query_sql = "select distinct subject from entity_question_new where type is not null;"	

		subject_list = []

		try:
			if mysql.query(query_sql):
				subject_tuple =  mysql.fetchall()
				
				for type in subject_tuple:
					tmp_tuple = (type[0])
					subject_list.append(tmp_tuple)
				return subject_list

			else:
				return None

		except DBException as e:
			LOG.error('get subject error [%s]' % e)
			raise CkException('get subject error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:27,代碼來源:business.py

示例6: get_group_list

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def get_group_list(system_id):
	
		mysql = Mysql()

		mysql.connect_master()
		
		query_sql = "select A.id,A.name,B.num from (select id,name from entity_group where system_id=%(system_id)d or id=0)A left outer join (select question_group,count(1) as num from entity_question where upload_id=%(system_id)d group by question_group)B on (A.id=B.question_group);" 
		
		try:
			if mysql.query(query_sql,system_id = system_id):

				res = mysql.fetchall()

				group_list = []

				for line in res:
					group_id = line[0]
					group_name = line[1]
					question_num = int(line[2]) if line[2] else 0					
					group_dict = {'id':int(group_id),'name':group_name,'num':int(question_num)}
					group_list.append(group_dict)
			
				return group_list
			else:
				return False

		except DBException as e:
			LOG.error('check topic error [%s]' % e)
			raise CKException('check topic error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:31,代碼來源:business.py

示例7: get

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
 def get(self):
     enter_func(self)
     if not set(['subject', 'grade', 'version']).issubset(self.request.arguments.keys()):
         return leave_func(self, 1)
     params = { 'subject': self.request.arguments['subject'][0], 'grade': self.request.arguments['grade'][0], 'version': self.request.arguments['version'][0] }
     if 'unit' in self.request.arguments.keys():
         params['Unite'] = self.request.arguments['unit'][0]
     if 'lesson' in self.request.arguments.keys():
         params['Lesson'] = self.request.arguments['lesson'][0]
     if 'word' in self.request.arguments.keys():
         params['word'] = self.request.arguments['word'][0]
     if 'stype' in self.request.arguments.keys():
         params['stype'] = self.request.arguments['stype'][0]
     if 'order' in self.request.arguments.keys():
         params['order'] = self.request.arguments['order'][0]
     if 'page_num' in self.request.arguments.keys():
         params['pn'] = self.request.arguments['page_num'][0]
     else:
         params['pn'] = 1
     if 'page_size' in self.request.arguments.keys():
         params['rn'] = self.request.arguments['page_size'][0]
     params['token'] = generate_token()
     params['host'] = host
     url = 'http://wenku.baidu.com/api/interface/getsubject?%s' % urllib.urlencode(params)
     LOG.info(url)
     ret = json.loads(urllib2.urlopen(url).read().decode('raw_unicode_escape'))
     LOG.info(ret)
     if 0 != ret['status']['code']:
         LOG.error('baidu library interface error: %s' % ret['status'])
         return leave_func(self, 100)
     ret = dict(error_process(0).items() + ret['data'].items())
     leave_func(self, 0)
     return self.write(json.dumps(ret, ensure_ascii=False))
開發者ID:XDF-server,項目名稱:api_resource,代碼行數:35,代碼來源:question.py

示例8: select_collection

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def select_collection(self,collection):
		
		try:
			self.collection = self.db[collection]

		except ServerSelectionTimeoutError as e:
			LOG.error('mongo select failed [%s]' % e)
			raise DBException('mongo select failed')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:10,代碼來源:mongo.py

示例9: connect

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def connect(self,db):
	
		configer = Configer()

		mongo_host = configer.get_configer('MONGO','host')
		mongo_port = int(configer.get_configer('MONGO','port'))
			
		try:
			self.client = MongoClient(host = mongo_host,port = mongo_port)
			self.db = self.client[db]
	
		except ConnectionFailure,e:
			LOG.error('mongo connect failed [%s]' % e)
			raise DBException('mongo connect failed')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:16,代碼來源:mongo.py

示例10: is_topic

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def is_topic(topic_id):
		
		mysql = Mysql()

		mysql.connect_master()
		
		query_sql = "select 1 from entity_topic where id = %(topic_id)d;" 
		
		try:
			if mysql.query(query_sql,topic_id = int(topic_id)):
				return True
			else:
				return False

		except DBException as e:
			LOG.error('check topic error [%s]' % e)
			raise CKException('check topic error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:19,代碼來源:business.py

示例11: chapter_id_exist

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def chapter_id_exist(chapter_id):

		mysql = Mysql()

		mysql.connect_master()
		
		query_sql = "select 1 from entity_teaching_chapter where id='%(chapter_id)d';" 
		
		try:
			if mysql.query(query_sql,chapter_id = int(chapter_id)):
				return True
			else:
				return False

		except DBException as e:
			LOG.error('check chapter error [%s]' % e)
			raise CKException('check chapter error')
開發者ID:XDF-server,項目名稱:api_resource,代碼行數:19,代碼來源:business.py

示例12: is_seriess

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def is_seriess(seriess_id):
		
		mysql = Mysql()
		
		mysql.connect_master()

		query_sql = "select 1 from entity_seriess where id = %(seriess_id)d;"
		
		try:
			if mysql.query(query_sql,seriess_id = int(seriess_id)):
				return True
			else:
				return False

		except DBException as e:
			LOG.error('check seriess error [%s]' % e)
			raise CkException('check seriess error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:19,代碼來源:business.py

示例13: is_type

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def is_type(type_id):
		
		mysql = Mysql()
		
		mysql.connect_master()

		query_sql = "select name from entity_question_type where type_id = %(type_id)d and enable = 1;"
		
		try:
			if mysql.query(query_sql,type_id = int(type_id)):
				return mysql.fetch()[0]
			else:
				return False

		except DBException as e:
			LOG.error('check type error [%s]' % e)
			raise CkException('check type error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:19,代碼來源:business.py

示例14: update_json_by_id

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def update_json_by_id(oldid,json):
		
		mysql = Mysql()

		mysql.connect_master()

		query_sql = "update entity_question_new set json='%(question_json)s' where oldid=%(oldid)d;"	

		try:
			if mysql.query(query_sql,oldid = int(oldid),question_json = json):
				return True
			else:
				return False

		except DBException as e:
			LOG.error('update json error [%s]' % e)
			raise CkException('update json error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:19,代碼來源:business.py

示例15: group_id_exist

# 需要導入模塊: from gl import LOG [as 別名]
# 或者: from gl.LOG import error [as 別名]
	def group_id_exist(group_id):
		
		mysql = Mysql()

		mysql.connect_master()
		
		query_sql = "select 1 from entity_group where id = '%(group_id)d';" 
		
		try:
			if mysql.query(query_sql,group_id = int(group_id)):
				return True
			else:
				return False

		except DBException as e:
			LOG.error('check topic error [%s]' % e)
			raise CKException('check topic error')
開發者ID:XDF-server,項目名稱:exhibit,代碼行數:19,代碼來源:business.py


注:本文中的gl.LOG.error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。