I've been reading up on extending pyramid applications and trying this out. 
but it's not working as I expect.
http://docs.pylonsproject.org/projects/pyramid/en/1.2-branch/narr/extending.html

Anyone see anything immediately wrong with this?
 

import unittest
from webtest import TestApp
from pyramid.configuration import Configurator
from pyramid.response import Response


def default_view(request):
    return Response("")


def config_user_app(config, with_route=False):
    if with_route:
        route_name = "default"
    else:
        route_name = None

    if route_name:
        config.add_route(route_name, "/")

    config.add_view(default_view, name="login", route_name=route_name)
    config.add_view(default_view, name="logout", route_name=route_name)


class TestApplicationComposition(unittest.TestCase):
    def testUserApp(self):
        """works"""
        cfg = Configurator()
        cfg.include(config_user_app)
        app = TestApp(cfg.make_wsgi_app())
        app.get("/login")
        app.get("/logout")

    def testIncluded(self):
        """
        fails with 404
        """
        route_prefix = "user"
        cfg = Configurator()
        cfg.include(config_user_app, route_prefix=route_prefix)
        app = TestApp(cfg.make_wsgi_app())
        app.get("/user/login")
        app.get("/user/logout")

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/pylons-discuss/-/i6WyT3O6CCEJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to