On 24 August 2013 17:30, Patrick Hetu <patrick.h...@gmail.com> wrote: > import imp > import glob > from os.path import abspath, dirname, join > > PROJECT_DIR = abspath(dirname(__file__)) > > conffiles = glob.glob(join(PROJECT_DIR, 'juju_settings', '*.py')) > > for f in conffiles: > execfile(abspath(f))
I don't know enough to comment on how suitable this is as a pattern for charms, but I can comment on this code: - Check that glob() returns a sorted list, or sort it yourself, to ensure that the results of that code is stable. - Also, execfile() is gone in Python 3.3 (and possibly earlier, I haven't checked). There are lots of workarounds to be found, but there's a peer-reviewed and tested one in Twisted, see twisted/python/compat.py. Good luck! Gavin. -- Juju mailing list Juju@lists.ubuntu.com Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju