本文整理匯總了Python中dmirr.model.DBSession.flush方法的典型用法代碼示例。如果您正苦於以下問題:Python DBSession.flush方法的具體用法?Python DBSession.flush怎麽用?Python DBSession.flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類dmirr.model.DBSession
的用法示例。
在下文中一共展示了DBSession.flush方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setup
# 需要導入模塊: from dmirr.model import DBSession [as 別名]
# 或者: from dmirr.model.DBSession import flush [as 別名]
def setup(self):
try:
new_attrs = {}
new_attrs.update(self.attrs)
new_attrs.update(self.do_get_dependencies())
self.obj = self.klass(**new_attrs)
DBSession.add(self.obj)
DBSession.flush()
return self.obj
except:
DBSession.rollback()
raise
示例2: change_email
# 需要導入模塊: from dmirr.model import DBSession [as 別名]
# 或者: from dmirr.model.DBSession import flush [as 別名]
def change_email(self, **kw):
u = db.query(model.User).filter_by(user_name=kw['u'])\
.filter_by(verify_code=kw['vc']).first()
if not u:
flash(_('Email verification failed. %s was not found or invalid code!' % kw['u']), 'warning')
redirect(url('/dashboard'))
u.email_address = kw['e']
db.flush()
flash(_('%s successfully changed email address to %s!' % (u.display_name, u.email_address)),
'info')
transaction.commit()
redirect(url('/dashboard'))