Hi,
We have two pylons apps that we want to combine using a composite
app. One of our pylons apps has a database that needs to be setup
using the standard 'paster setup-app' command. But, we need to be
able to do paster setup-app on our "composite.ini" that combines the
two apps. The problem is that this is not working our of the box -
the indiviudal apps config sections (where the database is configured)
are not being parsed.
We do have a work around, but it seems like this may be a bug:
We have a composite.ini files that is meant to configure both apps:
[server:main]
use = egg:Paste#http
host = 0.0.0.0
port = 5000
[composite:main]
use = egg:Paste#urlmap
/app1 = app1
/ = app2
[app:app1]
use = egg:ourapp
sqlalchemy.url = 'sqlite:///%(here)s/the.db'
sqlalchemy.convert_unicode=true
and so on
When we do
paster setup-app --name=app1 composite.ini
we get the following:
File "c:\castle\projects\rover\vizservers\simple\simple
\websetup.py", line 16, in setup_config
load_environment(conf.global_conf, conf.local_conf)
File "c:\castle\projects\rover\vizservers\simple\simple\config
\environment.py", line 42, in load_environment
engine = sa.engine_from_config(config, "sqlalchemy.")
File "c:\apps\python25\lib\site-packages\sqlalchemy-0.4.3-py2.5.egg
\sqlalchemy\engine\__init__.py", line 190, in engine_from_confi
g
url = opts.pop('url')
KeyError: 'pop(): dictionary is empty
We have traced this through and we find that the app:app1 section of
composite.ini is simply not being read. The reason is that
setup_config in websetup.py doesn't pass on the --name option we are
giving to paster setup-app:
def setup_config(command, filename, section, vars):
conf = appconfig('config:'+filename)
load_environment(conf.global_conf, conf.local_conf)
When we run paster setup-app --name=app1 composite.ini, section ends
up as "app:app1", but that is not passed on to appconfig in any way.
it looks like appconfig takes a name keywork argument, but it is not
being used. Our fix is the following: modify websetup.setup_config to
look like:
def setup_config(command, filename, section, vars):
conf = appconfig('config:'+filename, name=section.split(':')[1])
load_environment(conf.global_conf, conf.local_conf)
This seems like a very hackish way of getting this to work. Is there
another way of accomplishing this? Should I file a bug report?
Thanks
Brian
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
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
-~----------~----~----~----~------~----~------~--~---