[reportlab-users] Python 3.x progress

Robin Becker robin at reportlab.com
Wed Dec 4 08:19:05 EST 2013


We always had a sort of local rl config, but it wasn't exactly documented.
Inside rl_config there is code that does this

....
x='....value'
....


#### Normally don't need to edit below here ####
try:
from local_rl_config import *
except:
pass

.....

this allows fully overriding any of the x set in the start of rl_config, but not
modifications thereof.

Is this not enough? If not how should we separate the settings from the code
that resets re-registers etc etc.

One can imagine schemes like (pseudo code)

#rl_config.py

try:
import local_rl_settings
except:
import rl_settings
_settings = get_settings_from(rl_settings)
else:
import rl_settings
_settings = get_settings_from(rl_settings)
_settings.update(get_settings_from(local_rl_settings))

for k,v in _settings.items():
globals()[k] = v

......
reset code etc etc

that would allow local_rl_settings to import rl_settings and modify values and
keeps the defaults separate from the code. How one implements get_settings_from
etc is to be discussed.
--
Robin Becker


More information about the reportlab-users mailing list