def it_works_for_strings_numbers_and_iterables(self): assert is_blank("") == True assert is_blank(" ") == True assert is_blank(" \t \n \r ") == True assert is_blank(None) == True assert is_blank(0) == True assert is_blank([]) == True assert is_blank([None, None]) == True assert is_blank(42) == False assert is_blank("42") == False assert is_blank([None, 42]) == False
def filelog_abspath(self): cmdline = getattr(self.cmdline_args, "log_file_path", None) logging_json = (self.logging_json["handlers"].get("file", {}).get( "filename", None)) retv = ((cmdline if not is_blank(cmdline) else None) or getattr(self, "FILELOG_PATH", None) or (logging_json if not is_blank(logging_json) else None) or os.path.join(self.XDG_DATA_HOME, "production.log")) return (abspath_if_relative(retv, relative_to=self._REPO_ROOT) if self._IS_RUNNING_FROM_SOURCE else abspath_if_relative( retv, relative_to=self.XDG_DATA_HOME))
def logging_config_abspaths(self): cmdline = getattr(self.cmdline_args, "logging_config_path", None) if not is_blank(cmdline): return [(abspath_if_relative(cmdline, relative_to=self._REPO_ROOT) if self._IS_RUNNING_FROM_SOURCE else abspath_if_relative( cmdline, relative_to=self.XDG_CONFIG_HOME))] else: return [ "/etc/{{cookiecutter.project_slug}}/logging_config.json", os.path.join(self.XDG_CONFIG_HOME, "logging_config.json"), ]
def filelog_abspath(self): non_default = getattr(self.cmdline_args, "log_file_path", None) or self.logging_json["handlers"].get( "file", {}).get("filename", None) if not is_blank(non_default): if not os.path.isabs(non_default): raise ImproperlyConfiguredError( "Relative paths for --log-file-path are not allowed in " "test mode!") return non_default if self._IS_RUNNING_FROM_SOURCE: return os.path.join(self._REPO_ROOT, "log", "test.log") else: return os.path.join(self.DEFAULT_TEMP_DIR, "test.log")
def config_file_abspaths(self): cmdline = getattr(self.cmdline_args, "config_file_path", None) if not is_blank(cmdline): if not os.path.isabs(cmdline): raise ImproperlyConfiguredError( "Relative paths for --config-file-path are not allowed " "in test mode!") return [cmdline] if self._IS_RUNNING_FROM_SOURCE: return [os.path.join(self._REPO_ROOT, "config", "test.yaml")] else: return [ resource_filename( Requirement.parse("{{cookiecutter.project_slug}}"), "{{cookiecutter.project_slug}}/resources/test.yaml", ) ]
def config_file_abspaths(self): cmdline = getattr(self.cmdline_args, "config_file_path", None) if not is_blank(cmdline): return [ abspath_if_relative(cmdline, relative_to=self._REPO_ROOT) if self._IS_RUNNING_FROM_SOURCE else abspath_if_relative( cmdline, relative_to=self.XDG_CONFIG_HOME) ] else: return [ "/etc/{{cookiecutter.project_slug}}/production.yaml", "/etc/{{cookiecutter.project_slug}}/production.yml", "/etc/{{cookiecutter.project_slug}}/app.yaml", "/etc/{{cookiecutter.project_slug}}/app.yml", os.path.join(self.XDG_CONFIG_HOME, "production.yaml"), os.path.join(self.XDG_CONFIG_HOME, "production.yml"), os.path.join(self.XDG_CONFIG_HOME, "app.yaml"), os.path.join(self.XDG_CONFIG_HOME, "app.yml"), ]