from pyramid.config import Configurator
import couchdb


def main(global_config, **settings):
    """ This function returns a Pyramid WSGI application.
    """
    config = Configurator(settings=settings)

 #   config.registry.settings = settings

    config.include('pyramid_chameleon')
    config.add_static_view('static', 'static', cache_max_age=3600)
    config.add_route('home', '/')
    config.add_route('event', '/{event}/')
    config.add_route('image', '/{event}/{image}/')
    config.add_route('image_thumb', '/{event}/{image}/thumb/')
    config.add_route('image_raw', '/{event}/{image}/raw/')
    config.scan()
    return config.make_wsgi_app()

@@ -203,49 +203,8 @@
 s)%0A%0A
- #   config.registry.settings = settings%0A
 %0A   
@@ -574,16 +574,192 @@
 g.scan()
+%0A%0A    couch = couchdb.Server(settings.get('couchdb_url'))%0A%0A    def get_couchdb(request):%0A        return couch%0A%0A    config.add_request_method(get_couchdb, 'couchdb', reify=True)
 %0A    ret

add couchdb reify to request