本文整理汇总了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,