sdserver.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:slidoc 作者: mitotic 项目源码 文件源码
def setupInteractive(cls, connection, path, action, slideId='', questionAttrs=None, rollbackOption=None):
        if Options['debug']:
            print >> sys.stderr, 'sdserver.setupInteractive:', path, action, cls._interactiveSession

        interactiveSession = UserIdMixin.get_path_base(cls._interactiveSession[1]) if cls._interactiveSession[1] else ''
        basePath = UserIdMixin.get_path_base(path) if path else ''
        if action == 'start':
            if interactiveSession and interactiveSession != basePath:
                raise Exception('There is already an interactive session: '+interactiveSession)
            if not basePath:
                return
            cls._interactiveSession = (connection, path, slideId, questionAttrs)
            cls._interactiveErrors = {}
            if rollbackOption:
                sdproxy.startTransactSession(basePath)

        elif action in ('rollback', 'end'):
            if not interactiveSession:
                return
            cls._interactiveSession = (None, '', '', None)
            cls._interactiveErrors = {}
            if sdproxy.transactionalSession(interactiveSession):
                if action == 'rollback':
                    sdproxy.rollbackTransactSession(interactiveSession)
                else:
                    sdproxy.endTransactSession(interactiveSession)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号