Hello,

I am trying to add a few project-specific commands to be available in
paster via paste.script entry point. Naturally, I need to access
project's configuration settings from within my commands.

I have copied code from websetup:setup_config but it works strangely.
Here is the code (abridged):

class InitDatabase(command.Command):
    def command(self):
        name = self.args[0]
        app_conf = appconfig('config:'+name, relative_to=conf_dir)
        print app_conf

I have three ini files: development.ini, test.ini and staging.ini.

For test.ini it works as it should, printing 21 entries. For
development.ini it only finds 7 entries (from DEFAULT). For
staging.ini it raises an error:


  File "/home/max/projects/dou-trunk/site/doupy/doupy/websetup.py",
line 54, in command
    app_conf = appconfig('config:'+name, relative_to=conf_dir)
  File "/usr/lib/python2.4/site-packages/PasteDeploy-1.3-py2.4.egg/
paste/deploy/loadwsgi.py", line 205, in appconfig
    return context.config()
  File "/usr/lib/python2.4/site-packages/PasteDeploy-1.3-py2.4.egg/
paste/deploy/loadwsgi.py", line 609, in config
    conf = AttrDict(self.global_conf)
TypeError: iteration over non-sequence

I suppose I am doing it in the wrong way. What is a correct way to
load application's paste config?

I also tried this:

    def command(self):
        filename = os.path.join(conf_dir, self.args[0])
        wsgi_app = paste.deploy.loadapp('config:%s' % filename)

It loads but attempt to access config
        print paste.deploy.CONFIG['app_conf']
yields infamous TypeError: No configuration has been registered for
this process or thread

Max.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com
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