Esempio n. 1
0
    def testNameFromParts(self):

        self.assertEquals(routing.name_from_canonical_parts(None, "one", "two", []), "one:two")

        self.assertEquals(routing.name_from_canonical_parts("pre", "one", "two", []), "pre:one:two")

        self.assertEquals(routing.name_from_canonical_parts(None, "one", "two", ["x", "y"]), "one:two")

        self.assertEquals(routing.name_from_canonical_parts("pre", "one", "two", ["x", "y"]), "pre:one:two")
Esempio n. 2
0
    def testNameFromParts(self):

        self.assertEquals(
            routing.name_from_canonical_parts(None, 'one', 'two', []),
            'one-two')

        self.assertEquals(
            routing.name_from_canonical_parts('pre', 'one', 'two', []),
            'pre-one-two')

        self.assertEquals(
            routing.name_from_canonical_parts(None, 'one', 'two', ['x', 'y']),
            'one-two')

        self.assertEquals(
            routing.name_from_canonical_parts('pre', 'one', 'two', ['x', 'y']),
            'pre-one-two')
Esempio n. 3
0
    def testNameFromParts(self):

        self.assertEquals(
            routing.name_from_canonical_parts(None, 'one', 'two', []),
            'one-two'
        )

        self.assertEquals(
            routing.name_from_canonical_parts('pre', 'one', 'two', []),
            'pre-one-two'
        )

        self.assertEquals(
            routing.name_from_canonical_parts(None, 'one', 'two', ['x', 'y']),
            'one-two'
        )

        self.assertEquals(
            routing.name_from_canonical_parts('pre', 'one', 'two', ['x', 'y']),
            'pre-one-two'
        )
Esempio n. 4
0
    def get_route_name(self,
        prefix=route_sentinel, controller=route_sentinel, action=route_sentinel):
        """
        Function used to build the route name for a given prefix, controller, and
        action. For example, build_action_route('admin','pages','view', id=2)
        will give you "admin:pages:view". Set prefix to False to exclude the
        current prefix from the route name.
        """
        prefix = prefix if prefix != route_sentinel else self.route.prefix
        controller = controller if controller != route_sentinel else self.route.controller
        action = action if action != route_sentinel else self.route.action

        return routing.name_from_canonical_parts(prefix, controller, action)
Esempio n. 5
0
    def get_route_name(self,
                       prefix=route_sentinel,
                       controller=route_sentinel,
                       action=route_sentinel):
        """
        Function used to build the route name for a given prefix, controller, and
        action. For example, build_action_route('admin','pages','view', id=2)
        will give you "admin:pages:view". Set prefix to False to exclude the
        current prefix from the route name.
        """
        prefix = prefix if prefix != route_sentinel else self.route.prefix
        controller = controller if controller != route_sentinel else self.route.controller
        action = action if action != route_sentinel else self.route.action

        return routing.name_from_canonical_parts(prefix, controller, action)
Esempio n. 6
0
    def get_route_name(self,
        prefix=route_sentinel, handler=route_sentinel, action=route_sentinel):
        """
        Function used to build the route name for a given prefix, handler, and
        action. For example, build_action_route('admin','pages','view', id=2)
        will give you "admin-pages-view". Set prefix to False to exclude the
        current prefix from the route name.
        """
        prefix = prefix if prefix != route_sentinel else self.prefix
        handler = handler if handler != route_sentinel else self.name
        action = action if action != route_sentinel else self.action

        if self.prefix:
            action = action.replace(self.prefix + '_', '')

        return routing.name_from_canonical_parts(prefix, handler, action)
Esempio n. 7
0
    def get_route_name(self,
                       prefix=route_sentinel,
                       handler=route_sentinel,
                       action=route_sentinel):
        """
        Function used to build the route name for a given prefix, handler, and
        action. For example, build_action_route('admin','pages','view', id=2)
        will give you "admin-pages-view". Set prefix to False to exclude the
        current prefix from the route name.
        """
        prefix = prefix if prefix != route_sentinel else self.prefix
        handler = handler if handler != route_sentinel else self.name
        action = action if action != route_sentinel else self.action

        if self.prefix:
            action = action.replace(self.prefix + '_', '')

        return routing.name_from_canonical_parts(prefix, handler, action)