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


Python Session.delete方法代码示例

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


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

示例1: set_test_settings

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import delete [as 别名]
def set_test_settings():
    """Restore settings after test is over."""
    # Save settings.
    settings_snapshot = [
        (s.app_settings_name, s.app_settings_value, s.app_settings_type)
        for s in Setting.query().all()]
    yield _set_settings
    # Restore settings.
    session = Session()
    keys = frozenset(k for (k, v, t) in settings_snapshot)
    for s in Setting.query().all():
        if s.app_settings_name not in keys:
            session.delete(s)
    for k, v, t in settings_snapshot:
        if t == 'list' and hasattr(v, '__iter__'):
            v = ','.join(v) # Quirk: must format list value manually.
        Setting.create_or_update(k, v, t)
    session.commit()
开发者ID:t-kenji,项目名称:kallithea-mirror,代码行数:20,代码来源:conftest.py

示例2: delete

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import delete [as 别名]
    def delete(cls, users_group_id):
        try:

            # check if this group is not assigned to repo
            assigned_groups = UserGroupRepoToPerm.query()\
                .filter(UserGroupRepoToPerm.users_group_id ==
                        users_group_id).all()

            if assigned_groups:
                raise UserGroupsAssignedException('RepoGroup assigned to %s' %
                                                   assigned_groups)

            users_group = cls.get(users_group_id, cache=False)
            Session.delete(users_group)
            Session.commit()
        except:
            log.error(traceback.format_exc())
            Session.rollback()
            raise
开发者ID:msabramo,项目名称:kallithea,代码行数:21,代码来源:db_1_2_0.py

示例3: delete

# 需要导入模块: from kallithea.model.meta import Session [as 别名]
# 或者: from kallithea.model.meta.Session import delete [as 别名]
 def delete(cls, id_):
     obj = cls.query().get(id_)
     Session.delete(obj)
开发者ID:msabramo,项目名称:kallithea,代码行数:5,代码来源:db_1_3_0.py


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