From 432981e3f0589c7b603d45b3acf66c75da159037 2015-03-25 17:23:18 From: Min RK Date: 2015-03-25 17:23:18 Subject: [PATCH] more profile awareness from config.manager to IPython subclass also enables specifying profile by name, instead of full path. --- diff --git a/IPython/config/manager.py b/IPython/config/manager.py index 429bfaa..9f7f2f5 100644 --- a/IPython/config/manager.py +++ b/IPython/config/manager.py @@ -8,7 +8,6 @@ import json import os from IPython.config import LoggingConfigurable -from IPython.utils.path import locate_profile from IPython.utils.py3compat import PY3 from IPython.utils.traitlets import Unicode @@ -35,22 +34,12 @@ def recursive_update(target, new): class BaseJSONConfigManager(LoggingConfigurable): - """General config manager + """General JSON config manager Deals with persisting/storing config in a json file - in IPython profile """ - profile_dir = Unicode() - def _profile_dir_default(self): - return locate_profile() - - @property - def config_dir(self): - return self._config_dir() - - def _config_dir(self): - return self.profile_dir + config_dir = Unicode('.') def ensure_config_dir_exists(self): try: diff --git a/IPython/html/services/config/manager.py b/IPython/html/services/config/manager.py index c268284..534d095 100644 --- a/IPython/html/services/config/manager.py +++ b/IPython/html/services/config/manager.py @@ -3,12 +3,19 @@ # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. -import os - from IPython.config.manager import BaseJSONConfigManager +from IPython.utils.path import locate_profile +from IPython.utils.traitlets import Unicode class ConfigManager(BaseJSONConfigManager): """Config Manager used for storing notebook frontend config""" + + profile = Unicode('default', config=True) + + profile_dir = Unicode(config=True) + + def _profile_dir_default(self): + return locate_profile(self.profile) - def _config_dir(self): - return os.path.join(self.profile_dir, 'nbconfig') + def _config_dir_default(self): + return self.profile_dir