本文整理匯總了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
示例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
示例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
示例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
示例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
示例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