def compile(dotted_name, rawtext): CompilerClass = utils.load_class(dotted_name) if not issubclass(CompilerClass, ArticleCompiler): # FIXME: raise appropriate goblog-specific exception raise RuntimeError("Compiler must be a subclass of ArticleCompiler.") compiler = CompilerClass() return compiler(rawtext)
def gettheme(dotted_theme_name): if dotted_theme_name not in _cache: try: cls = utils.load_class(dotted_theme_name) except Exception as e: m = "Unable to load theme: '{0}': {1}." raise RuntimeError(m.format(dotted_theme_name, str(e))) if not issubclass(cls, Theme): # FIXME: raise appropriate goblog-specific exception raise RuntimeError("Themes must be a subclass of Theme.") _cache[dotted_theme_name] = cls return _cache[dotted_theme_name]