本文整理匯總了Python中app.model.DBSession.flush方法的典型用法代碼示例。如果您正苦於以下問題:Python DBSession.flush方法的具體用法?Python DBSession.flush怎麽用?Python DBSession.flush使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類app.model.DBSession
的用法示例。
在下文中一共展示了DBSession.flush方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: setup
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import flush [as 別名]
def setup(self):
try:
new_attrs = {}
new_attrs.update(self.attrs)
new_attrs.update(self.do_get_dependencies())
setup()
self.obj = self.klass(**new_attrs)
DBSession.add(self.obj)
DBSession.flush()
return self.obj
except:
DBSession.rollback()
raise
示例2: sendMessage
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import flush [as 別名]
def sendMessage(title, text, recipients, parentId=None, authorId=None):
from tg import request
authorId = None
if authorId is None:
authorId = request.identity['user'].user_id
msg = Message(title=title,
text=text,
author_id=authorId,
parent_id=parentId)
DBSession.add(msg)
DBSession.flush()
UserMessage.sendMessageToUsers(msg, recipients)
示例3: setUp
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import flush [as 別名]
def setUp(self):
super(TestStructureSearch,self).setUp()
org=DBSession.query(ReagentVendor).first()
for name, smiles in self.smilesToReg.items():
mol = ReagentMol(toMolFromSmiles(smiles))
mol.mol_name = name
submitter = User.by_user_name('chemadmin')
lot = ReagentLot()
lot.lot_submitter_id = submitter.user_id
lot.lot_source_org_id = org.vendor_id
mol.addLot(lot, 0)
DBSession.add(mol)
DBSession.flush()
示例4: loadFeedDict
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import flush [as 別名]
def loadFeedDict(cls, feeds):
for feed in feeds:
guid = feed["id"]
try:
message = DBSession.query(Message).filter(Message.guid == guid).one()
if _compareTime(message.updated.timetuple(),feed["updated_parsed"]) < 0:
message.update(title=feed["title"],
link=feed["link"],
updated=feed["updated"],
text=feed["summary"])
userMessages = DBSession.query(UserMessage).filter(UserMessage.message == message.message_id).all()
for userMessage in userMessages:
userMessage.new = True
except NoResultFound:
message = Message(text=feed["summary"], guid=feed["id"], **feed)
DBSession.add(message)
DBSession.flush()
cls.sendMessageToAllUsers(message)
示例5: gridInsert
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import flush [as 別名]
def gridInsert(self,modelObjects,row):
o=modelObjects[self.rptCfg.pkcol.modelClass]
DBSession().add(o)
DBSession.flush()
return (o,)
示例6: gridInsert
# 需要導入模塊: from app.model import DBSession [as 別名]
# 或者: from app.model.DBSession import flush [as 別名]
def gridInsert(self, modelObjects,row):
mol=modelObjects[self._molClass]
DBSession.add(mol)
DBSession.flush()
return mol,