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