def checked_execute(self): """ Checks for settings before run """ if self.settings is None: self._add_options() self.settings = self._check_for_settings() else: add_to_path(self.settings.PROJECT_ROOT, 1) self._check_settings_errors() self._check_project_type() BaseCommand.checked_execute(self)
def _check_for_settings(self): """ tries to import the user's settings file """ (options, args) = self.parser.parse_args(self.args) if options.settings is not None: settings_dir, file_name = os.path.split(options.settings) add_to_path(settings_dir) settings_file = os.path.splitext(file_name)[0] else: add_to_path(os.getcwd()) settings_file = "settings" settings = import_user_module(settings_file) add_to_path(settings.PROJECT_ROOT) return settings
def _check_for_settings(self): """ tries to import the user's settings file """ (options, args) = self.parser.parse_args(self.args) if options.settings is not None: settings_dir, file_name = os.path.split(options.settings) add_to_path(settings_dir) settings_file = os.path.splitext(file_name)[0] else: add_to_path(os.getcwd()) settings_file = "settings" settings = import_user_module(settings_file) add_to_path(settings.PROJECT_ROOT, 1) return settings