当前位置: 首页>>代码示例>>Python>>正文


Python DBSession.add方法代码示例

本文整理汇总了Python中app.model.DBSession.add方法的典型用法代码示例。如果您正苦于以下问题:Python DBSession.add方法的具体用法?Python DBSession.add怎么用?Python DBSession.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app.model.DBSession的用法示例。


在下文中一共展示了DBSession.add方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: sendMessageToUser

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [as 别名]
 def sendMessageToUser(cls, message, userId):
     if str(userId) == "#":
         user = _InnectusUser
         _sendMessageViaMail(message, user)
     else:
         user = DBSession.query(User).filter(User.user_id == userId).one()
         #_sendMessageViaMail(message, user)
         userMessage = cls(user, message)
         DBSession.add(userMessage)
开发者ID:aytsai,项目名称:ricebowl,代码行数:11,代码来源:messages.py

示例2: setUp

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [as 别名]
 def setUp(self):
     '''
     Need a row of data in the login audit table
     '''
     super(TestUserAdministration, self).setUp()
     aud = AuditLogin(dict(REMOTE_ADDR='127.0.0.1'), dict(user_name='chemadmin'))
     result = AuditLoginResult.get('LOGIN_SUCCESS')
     aud.login_result = result
     log.debug(aud in DBSession())
     DBSession.add(aud)
     transaction.commit()
开发者ID:aytsai,项目名称:ricebowl,代码行数:13,代码来源:test_admin.py

示例3: setup

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [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
开发者ID:aytsai,项目名称:ricebowl,代码行数:15,代码来源:__init__.py

示例4: sendMessage

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [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)
开发者ID:aytsai,项目名称:ricebowl,代码行数:15,代码来源:messages.py

示例5: setUp

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [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()
开发者ID:aytsai,项目名称:ricebowl,代码行数:16,代码来源:test_struct_search.py

示例6: loadFeedDict

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [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)
开发者ID:aytsai,项目名称:ricebowl,代码行数:20,代码来源:messages.py

示例7: gridInsert

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [as 别名]
 def gridInsert(self, modelObjects,row):
     mol=modelObjects[self._molClass]
     DBSession.add(mol)
     DBSession.flush()
     return mol,
开发者ID:aytsai,项目名称:ricebowl,代码行数:7,代码来源:grids.py

示例8: sendMessageToAllUsers

# 需要导入模块: from app.model import DBSession [as 别名]
# 或者: from app.model.DBSession import add [as 别名]
 def sendMessageToAllUsers(cls, message):
     users = DBSession.query(User).all()
     for user in users:
         userMessage = cls(user, message)
         DBSession.add(userMessage)
开发者ID:aytsai,项目名称:ricebowl,代码行数:7,代码来源:messages.py


注:本文中的app.model.DBSession.add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。