Marconi
Marconi

Reputation: 3651

Reusing paste config entry

I have the following Pyramid .ini file:

[DEFAULT]
redis.host = localhost
redis.port = 6379
redis.db = 0

[app:main]
...

# beaker session
session.type = redis
session.url = localhost:6379

In the app:main section's session.url I want to use what's defined under DEFAULT section's redis.host and redis.port.

In my understanding everything under DEFAULT section is global and is passed to other sections. But if I want to reuse a settings from DEFAULT and assign it a different name under other sections how do I do that?

I'm looking at the same way I can reference section entry in buildout .cfg files using ${<section name>:<entry>}.

Upvotes: 0

Views: 279

Answers (1)

Michael Merickel
Michael Merickel

Reputation: 23331

session.url = %(redis.host)s:%(redis.port)s

Should do the trick.

Upvotes: 3

Related Questions