Is there any way to access options in a shorter format?

Asked by Stuart Metcalfe

For example, I've created my schema and got my config object as described in the getting started docs, but I have to do this to get my configuration:


Is there any way to do something slightly shorter like this?

config.optionname <- note: no need to specify __main__

Question information

English Edit question
configglue Edit question
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Launchpad Janitor (janitor) said :

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Ricardo Kirkner (ricardokirkner) said :

With the code currently in trunk there is. The configglue helper function

>>> class MySchema(Schema):
... project = StringConfigOption(default='my-project')

>>> glue = configglue(MySchema, ['config.ini'])

returns an object which has a 'options' attribute you can use exactly as proposed.

>>> glue.options.project

Can you help with this problem?

Provide an answer of your own, or ask Stuart Metcalfe for more information if necessary.

To post a message you must log in.