durusmail: quixote-users: config class / config.py
config class / config.py
2011-05-17
2011-05-23
config class / config.py
Robert Ladyman
2011-05-23
Oh well - nobody has replied, so I'll just state what I did in case it is
useful for others.

I wrapped the configuration settings for my local server into a dict that
could then be passed to set_from_dict. So, for example, in svrconfig.py I can
have:-

SVRConfig =dict(
ERROR_EMAIL = None,
ACCESS_LOG = "/tmp/bn_access.log",
ERROR_LOG = "/tmp/bn_error.log",
DISPLAY_EXCEPTIONS =None,
COMPRESS_PAGES = False,
FORM_TOKENS = False,
SESSION_COOKIE_NAME = "bn_session"
)


and then in __init__.py for the project:-

from svrconfig import SVRConfig
....
....
theConfig = Config()
theConfig.set_from_dict(SVRConfig)






> Can I ask, is  config class (and an associated file) deprecated and/or will
>  it be removed in a future version?
>
> Just want to know before I go using it. It strikes me that it is useful as
>  one can use the same scgi_server.py and __init__.py files for different
>  servers (with various parameters read from one or more config files)
>  although I was a bit worried about the 'execfile()' call in read_file
>  (also, I think that's going to disappear in Python 3).
>
> RJL
>

--
Robert Ladyman
File-Away Limited
3 Ralston Business Centre, Newtyle, Blairgowrie
Perthshire  PH12 8TL SCOTLAND
Tel: +44 (0) 1828 898 158
Mobile: +44 (0) 7732 771 649
http://www.file-away.co.uk

============================================
Registered Office: 32 Church Street, Newtyle, Blairgowrie
Perthshire, PH12 8TZ SCOTLAND
Registered in Scotland, Company Number SC222086

reply