From c5082498abf88d11fcecc22b112879f4389df276 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Sun, 30 Aug 2015 13:50:34 -0400 Subject: [PATCH] utils.py can't import non-standard modules because it is imported by migrate.py, which is run before anything is installed closes #540 --- management/utils.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/management/utils.py b/management/utils.py index b19f9721..9e628fd1 100644 --- a/management/utils.py +++ b/management/utils.py @@ -1,5 +1,8 @@ import os.path -import rtyaml + +# DO NOT import non-standard modules. This module is imported by +# migrate.py which runs on fresh machines before anything is installed +# besides Python. # THE ENVIRONMENT FILE AT /etc/mailinabox.conf @@ -22,11 +25,13 @@ def save_environment(env): # THE SETTINGS FILE AT STORAGE_ROOT/settings.yaml. def write_settings(config, env): + import rtyaml fn = os.path.join(env['STORAGE_ROOT'], 'settings.yaml') with open(fn, "w") as f: f.write(rtyaml.dump(config)) def load_settings(env): + import rtyaml fn = os.path.join(env['STORAGE_ROOT'], 'settings.yaml') try: config = rtyaml.load(open(fn, "r"))