Пример #1
0
def main(global_config, **settings):
    cerr('CMSFix main() is running...')
    config = init_app(global_config, settings, prefix='/mgr')
    config.include(includeme)
    set_workflow(GroupwareWorkflow())

    return config.make_wsgi_app()
Пример #2
0
def main_xxx(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)
    config.include('pyramid_chameleon')
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('home', '/')
    config.add_view('cmsfix.views.home.index', route_name='home')
    config.include( includeme )
    set_workflow(GroupwareWorkflow())
    #config.scan()
    return config.make_wsgi_app()
Пример #3
0
        print("node.state=%d" % node.state)
        if node.state == 100:
            return False
        if node.state == 101:
            return True
        if node.state == 102:
            return True
        return False

    def is_accessible(self, node, user):
        # journal node is accessible to owner and container's user
        if not user:
            return False
        print("check is_accessible()")
        if node.user_id == user.id:
            return True
        if isinstance(node, JournalNode):
            print("check parent container")
            if node.parent.user_id == user.id:
                return True
        if isinstance(node, JournalItemNode):
            return get_workflow(node.parent).is_accessible(node.parent, user)
        return False


# JournalWorkflow and JournalItemWorkflow are specials, created here first
journal_wf = JournalWorkflow()
journalitem_wf = JournalItemWorkflow()
set_workflow(journal_wf, JournalNode)
set_workflow(journalitem_wf, JournalItemNode)
Пример #4
0
        node.state = 2
        node.listed = False

    def is_accessible(self, node, user):
        """ comments follow the parent node """
        container_node = self.get_container_node(node)
        return container_node.is_accessible(node, user)

    def is_manageable(self, node, user):
        container_node = self.get_container_node(node)
        return container_node.is_manageable(node, user)

    def is_editable(self, node, user):
        # check whether this is the user
        if node.user.id == user.id:
            return True
        container_node = self.get_container_node(node)
        return container_node.is_editable(node, user)

    def get_container_node(self, node):
        parent_node = node.parent
        while True:
            if not isinstance(parent_node, CommentNode):
                return parent_node
            parent_node = parent_node.parent
        raise RuntimeError('FATAL ERR: this code should not be executed!!')

# CommentWorkflow created here
comment_wf = CommentWorkflow()
set_workflow(comment_wf, CommentNode)