當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。