本文整理汇总了Python中stackone.model.DBSession.remove方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.remove方法的具体用法?Python DBSession.remove怎么用?Python DBSession.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stackone.model.DBSession
的用法示例。
在下文中一共展示了DBSession.remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_work
# 需要导入模块: from stackone.model import DBSession [as 别名]
# 或者: from stackone.model.DBSession import remove [as 别名]
#.........这里部分代码省略.........
auth.user_name = self.user_name
auth.groups = groups
if result.get('email_address'):
auth.email_address = result['email_address']
#598
else:
logger.info(result['msg'])
raise Exception('Error in LDAP chcek: ' + result['msg'])
#598
else:
auth.user = user
auth.user_name = user.user_name
auth.email_address = user.email_address
#598
TaskUtil.set_task_context(self.task_id)
if recover != True and resume != True:
raw_result = self.exec_task(auth, self.context, *args, **kw)
#884
else:
#884
runn = self.get_running_instance()
if runn:
self.curr_instance = runn.timestamp
#785
else:
#785
task_result = self.get_task_result_instance()
if isinstance(task_result.results, str):
task_result.results += 'can not resume task. No running instance'
#779
else:
#779
if not task_result.results:
task_result.results = 'can not resume task. No running instance'
task_result_running_instance = False
if task_result_running_instance:
#883
if recover == True:
raw_result = self.recover_task(auth, self.context, *args, **kw)
#884
else:
if resume == True:
raw_result = self.resume_task(auth, self.context, *args, **kw)
if task_result_running_instance:
#1354
cancelled = False
results = raw_result
if isinstance(raw_result, dict):
#1152
if raw_result.get('status') == constants.TASK_CANCELED:
#1031
e = raw_result.get('msg') + '\n' + raw_result.get('results')
transaction.abort()
cancelled = True
if not self.quiet:
self.task_fail(e, auth, cancelled=True)
#1094
else:
if raw_result.get('status') == Task.SUCCEEDED:
results = raw_result.get('results')
visible = raw_result.get('visible', False)
if type(results)==dict:
#1148
if results.get('success')==True:
results = 'Task Completed Successfully.'
else:
#1355
if raw_result is not None and self.processors is not None:
#1250
#isinstance(raw_result, dict)
results = [raw_result]
for p in self.processors:
#1246
if issubclass(p, Processor):
p().process_output(results)
else:
results = raw_result
if results is None:
#1340
desc_tuple = self.get_short_desc()
if desc_tuple is None:
results = 'Task Completed Successfully.'
else:
short_desc,short_desc_params = desc_tuple
desc = short_desc % short_desc_params
results = desc + ' Completed Successfully.'
transaction.commit()
except Exception as e:
logger.exception(to_str(e))
transaction.abort()
if not self.quiet:
self.task_fail(e, auth)
else:
if not self.quiet and cancelled == False:
self.task_success(results, visible)
finally:
DBSession.remove()
return None