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


Python DBSession.delete方法代码示例

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


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

示例1: delete_category

# 需要导入模块: from bproject.models.models import DBSession [as 别名]
# 或者: from bproject.models.models.DBSession import delete [as 别名]
 def delete_category(self, idx):
     """ Removes category by id """
     log.debug("categories-delete")
     category = self.get_category_by_id(idx)
     if category:
         DBSession.delete(category)
         DBSession.flush()
     return category
开发者ID:bartoszp32,项目名称:BProject,代码行数:10,代码来源:settingsfacade.py

示例2: delete_entry

# 需要导入模块: from bproject.models.models import DBSession [as 别名]
# 或者: from bproject.models.models.DBSession import delete [as 别名]
 def delete_entry(self, idx):
     log.debug("delete-entry")
     entry = self.get_entry_by_id(idx)
     if entry:
         DBSession.delete(entry)
         DBSession.flush()
         return True
     else:
         log.error("Entry with id: {0} doesn't exists".format(idx))
     return False
开发者ID:bartoszp32,项目名称:BProject,代码行数:12,代码来源:settingsfacade.py

示例3: delete

# 需要导入模块: from bproject.models.models import DBSession [as 别名]
# 或者: from bproject.models.models.DBSession import delete [as 别名]
 def delete(self, place):
     log.debug("places_delete")
     if place:
         try:
             DBSession.delete(place)
             DBSession.flush()
             return True
         except Exception as ex:
             log.exception(ex)
     else:
         log.error("Empty place object")
     return False
开发者ID:bartoszp32,项目名称:BProject,代码行数:14,代码来源:placesfacade.py

示例4: delete

# 需要导入模块: from bproject.models.models import DBSession [as 别名]
# 或者: from bproject.models.models.DBSession import delete [as 别名]
 def delete(self, identifier):
     log.debug("delete")
     result = Return()
     try:
         user = self.by_identifier(identifier)
         if user:
             self.accounts.delete(identifier)
             DBSession.delete(user)
             DBSession.flush()
             result.success()
             self.history.add(static.options.users, static.actions.delete, "User: {0} deleted".format(user.name))
         else:
             result.notfound()
         log.info(result.msg)
     except Exception as ex:
         log.exception(ex)
         result.exception()
     return result
开发者ID:bartoszp32,项目名称:BProject,代码行数:20,代码来源:usersfacade.py

示例5: delete

# 需要导入模块: from bproject.models.models import DBSession [as 别名]
# 或者: from bproject.models.models.DBSession import delete [as 别名]
 def delete(self, name = None, group = None):
     log.debug("delete")
     response = Return()
     org = self.get(name = name, group = group)
     if org:
         try:
             DBSession.delete(org)
             DBSession.flush()
             response.success()
             response.msg = "Group {0} has been deleted".format(name)
             log.info(response.msg)
             self.history.add(static.options.groups, static.actions.delete, response.msg)
         except Exception as ex:
             DBSession.rollback()
             log.exception(ex)
             response.exception()
     else:
         response.notfound()
         log.error(response.msg)
     return response
开发者ID:bartoszp32,项目名称:BProject,代码行数:22,代码来源:groupsfacade.py

示例6: delete

# 需要导入模块: from bproject.models.models import DBSession [as 别名]
# 或者: from bproject.models.models.DBSession import delete [as 别名]
 def delete(self, identifier):
     log.debug("delete")
     result = Return()
     try:
         if identifier:
             account = self.by_identifier(identifier)
             if account:
                 DBSession.delete(account)
                 log.debug("account: {0} has been removed".format(account.login))
                 if account.loginfo:
                     for i, info in enumerate(account.loginfo):
                         DBSession.delete(info)
                         log.debug("{0}: login info removed")
                     log.info("{0} login informations has been removed".format(len(account.loginfo)))
                 result.success()
             else:
                 result.notfound()
         else:
             result.nodata()
         log.info(result.msg)
     except Exception as ex:
         log.exception(ex)
         result.exception()
     return result
开发者ID:bartoszp32,项目名称:BProject,代码行数:26,代码来源:accountfacade.py


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