5.1 Fake Application Harness
Description: Fake Application Harness
Keywords: albatross

#
5.1 Fake Application Harness

Some of the explanatory examples in this chapter require application functionality. The following fake application is used as an execution harness to drive the interactive examples.

    import sys
    import albatross

    class Request:

        def get_uri(self):
            return 'http://www.com/fakeapp.py'

        def write_header(self, name, value):
            pass

        def end_headers(self):
            pass

        def write_content(self, data):
            sys.stdout.write(data)

    app = albatross.SimpleApp(base_url='fakeapp.py',
                              template_path='.',
                              start_page='start',
                              secret='secret')

    ctx = albatross.SessionAppContext(app)
    ctx.set_request(Request())