I had a look at karl run.py and karl.ini files and realized I had to
use the global_settings instead of **settings in the run.py of my
application.

On Fri, Dec 3, 2010 at 12:20 PM, Danny Navarro <j...@dannynavarro.net> wrote:
> Hi all,
>
> I'm following the example from the documentation
> http://docs.repoze.org/zodbconn/narr.html#connecting-to-zodb-in-a-wsgi-pipeline
>
> But when running paster I get this error:
>
> ---------
> Traceback (most recent call last):
>  File "/home/danny/sandbox/virtualenvs/mzcms26env/bin/paster", line
> 9, in <module>
>    load_entry_point('PasteScript==1.7.3', 'console_scripts', 'paster')()
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py",
> line 84, in run
>    invoke(command, command_name, options, args[1:])
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py",
> line 123, in invoke
>    exit_code = runner.run(args)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/command.py",
> line 218, in run
>    result = self.command()
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py",
> line 276, in command
>    relative_to=base, global_conf=vars)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteScript-1.7.3-py2.6.egg/paste/script/serve.py",
> line 313, in loadapp
>    **kw)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py",
> line 203, in loadapp
>    return loadobj(APP, uri, name=name, **kw)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py",
> line 224, in loadobj
>    return context.create()
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py",
> line 617, in create
>    return self.object_type.invoke(self)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py",
> line 163, in invoke
>    app = context.app_context.create()
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py",
> line 617, in create
>    return self.object_type.invoke(self)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/loadwsgi.py",
> line 109, in invoke
>    return fix_call(context.object, context.global_conf, **context.local_conf)
>  File 
> "/home/danny/sandbox/virtualenvs/mzcms26env/lib/python2.6/site-packages/PasteDeploy-1.3.4-py2.6.egg/paste/deploy/util/fixtypeerror.py",
> line 57, in fix_call
>    val = callable(*args, **kw)
>  File "/home/danny/sandbox/virtualenvs/mzcms26env/mzcms/trunk/mzcms/run.py",
> line 16, in app
>    raise ValueError("No 'zodb_uri' in application configuration.")
> ValueError: No 'zodb_uri' in application configuration.
> --------
>
> (The args variable in fixtypeerror.py looks alright, the zodb_uri is there)
>
> This is my ini file:
> ---------
> [DEFAULT]
> zodb_uri = file://%(here)s/db/mzcms.db?connection_cache_size=20000
>
> [pipeline:main]
> pipeline =
>    egg:repoze.zodbconn#connector
>    egg:repoze.retry#retry
>    egg:repoze.tm2#tm
>    egg:mzcms#app
>
> [server:main]
> use = egg:Paste#http
> host = 0.0.0.0
> port = 6543
> ---------
>
> And my run.py file:
> ---------
> from repoze.bfg.configuration import Configurator
> from repoze.zodbconn.finder import PersistentApplicationFinder
>
> from mzcms.models.site import appmaker
>
> def app(global_config, **settings):
>    """ This function returns a WSGI application.
>
>    It is usually called by the PasteDeploy framework during
>    ``paster serve``.
>    """
>    zodb_uri = settings.get('zodb_uri')
>    zcml_file = settings.get('configure_zcml', 'configure.zcml')
>    if zodb_uri is None:
>        raise ValueError("No 'zodb_uri' in application configuration.")
>
>    finder = PersistentApplicationFinder(zodb_uri, appmaker)
>    def get_root(request):
>        return finder(request.environ)
>    config = Configurator(root_factory=get_root, settings=settings)
>    config.begin()
>    config.load_zcml(zcml_file)
>    config.end()
>    return config.make_wsgi_app()
> ---------
> (settings is empty here)
>
> What am I doing wrong?
>
> --
> Danny Navarro  |  http://dannynavarro.net
>



-- 
Danny Navarro  |  http://dannynavarro.net
_______________________________________________
Repoze-dev mailing list
Repoze-dev@lists.repoze.org
http://lists.repoze.org/listinfo/repoze-dev

Reply via email to