コード例 #1
0
ファイル: testing.py プロジェクト: MicaSz/adhocracy-3
def tearDown(**kwargs):
    """
       tearDown basic test environment with database
       proxy to paramid.testing.tearDown(**kwargs)
    """
    graph = get_graph()
    tx = graph.start_transaction()
    graph.clear()
    graph.stop_transaction(tx)
    testing.tearDown(**kwargs)
コード例 #2
0
def adhocracyroot_factory():
    graph = get_graph()
    root = graph.get_root_vertex()
    if not IAdhocracyRootMarker.providedBy(root):
        tx = graph.start_transaction()
        root.set_property("main_interface",\
                IAdhocracyRootMarker.__identifier__)
        directlyProvides(root, IAdhocracyRootMarker)
        graph.stop_transaction(tx)
    return root
コード例 #3
0
ファイル: testing.py プロジェクト: MicaSz/adhocracy-3
def tearDown(**kwargs):
    """
       tearDown basic test environment with database
       proxy to paramid.testing.tearDown(**kwargs)
    """
    graph = get_graph()
    tx = graph.start_transaction()
    graph.clear()
    graph.stop_transaction(tx)
    testing.tearDown(**kwargs)
コード例 #4
0
ファイル: relations.py プロジェクト: MicaSz/adhocracy-3
 def __delitem__(self, key):
     edges = filter(lambda edge: IChild(edge).child_name == key,\
                                 self.context.in_edges("child"))
     if len(edges) == 1:
         edge = edges[0]
         graph = get_graph()
         graph.remove_edge(edge)
     elif len(edges) == 0:
         raise KeyError
     else:
         raise KeyError("multiple child nodes with key %s" % (key))
コード例 #5
0
    def setUp(self, **kwargs):
        tools = setUpFunctional()
        self.browser = tools["browser"]
        self.app = tools["app"]
        self.root = self.app.root_factory(None)

        from adhocracy.dbgraph.embeddedgraph import get_graph
        self.graph = get_graph()
        global_registry = component.getGlobalSiteManager()
        from adhocracy.core.models.relations import NodeChildsDictAdapter
        global_registry.registerAdapter(NodeChildsDictAdapter)

        from repoze.lemonade.testing import registerContentFactory
        from adhocracy.core.models.references import child_factory
        from adhocracy.core.models.references import IChildMarker
        registerContentFactory(child_factory, IChildMarker)

        from adhocracy.core.models.container import container_factory
        from adhocracy.core.models.container import IContainerMarker
        registerContentFactory(container_factory, IContainerMarker)

        from adhocracy.core.models.references import Child
        global_registry.registerAdapter(Child)
コード例 #6
0
    def setUp(self, **kwargs):
        tools = setUpFunctional()
        self.browser = tools["browser"]
        self.app = tools["app"]
        self.root = self.app.root_factory(None)

        from adhocracy.dbgraph.embeddedgraph import get_graph
        self.graph = get_graph()
        global_registry = component.getGlobalSiteManager()
        from adhocracy.core.models.relations import NodeChildsDictAdapter
        global_registry.registerAdapter(NodeChildsDictAdapter)

        from repoze.lemonade.testing import registerContentFactory
        from adhocracy.core.models.references import child_factory
        from adhocracy.core.models.references import IChildMarker
        registerContentFactory(child_factory, IChildMarker)

        from adhocracy.core.models.container import container_factory
        from adhocracy.core.models.container import IContainerMarker
        registerContentFactory(container_factory, IContainerMarker)

        from adhocracy.core.models.references import Child
        global_registry.registerAdapter(Child)
コード例 #7
0
ファイル: container.py プロジェクト: MicaSz/adhocracy-3
def container_factory():
    graph = get_graph()
    content = graph.add_vertex(IContainerMarker)
    return content
コード例 #8
0
ファイル: references.py プロジェクト: MicaSz/adhocracy-3
def child_factory(child, parent, child_name):
    graph = get_graph()
    content = graph.add_edge(child, parent, "child", \
                             main_interface=IChildMarker)
    content.set_property("child_name", child_name)
    return content